Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vuex-module-decorators support ? #2

Open
mtltechtemp opened this issue May 11, 2019 · 1 comment
Open

vuex-module-decorators support ? #2

mtltechtemp opened this issue May 11, 2019 · 1 comment

Comments

@mtltechtemp
Copy link

I can't manage to make it work.

The main issue i think is with the fieryState "wrapper", etc.

Here's my code:

import { Module, VuexModule, Mutation, Action } from "vuex-module-decorators";
import { firebase, auth, StoreDB, functions } from "@/services/fireinit";
import {
  fieryBindings,
  fieryActions,
  fieryMutations,
  fieryMapMutations,
  fieryState,
  FieryRecordSave,
  FieryRecordRemove
} from "fiery-vuex";
import { store } from "..";

class Todo {
  name: string = "";
  done: boolean = false;
  done_at: Date | null = null;

  save: FieryRecordSave;
  remove: FieryRecordRemove;
}

const TodoOptions = {
  shared: true,
  type: Todo,
  include: ["name", "done", "done_at"],
  timestamps: ["done_at"],
  record: true,
  recordOptions: {
    save: "save",
    remove: "remove"
  }
};

@Module({
  stateFactory: true,
  name: "Todo",
  store: store
})
export default class TodoModule extends VuexModule {
    currentTodo: Todo | null = null;
    todos: Todo[] = [];

    // can't use ... operator inside a class so it's broken
    // I believe we need a decorator.
    ...fieryState($fiery => {
      // Duplicate identifier '$fiery'.
      specificTodo: $fiery(StoreDB.collection('todos').doc(23), TodoOptions) as Todo
    })
}
@mtltechtemp
Copy link
Author

@ClickerMonkey ping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant