How to use the @vuex-orm/core.use function in @vuex-orm/core

To help you get started, we’ve selected a few @vuex-orm/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuex-orm / plugin-axios / test / feature / VuexORMAxios.spec.ts View on Github external
it('throws when calling api request without registering the axios', () => {
    VuexORM.use(VuexORMAxios)

    // tslint:disable-next-line
    expect(() => { Model.api().axios }).toThrowError('Vuex ORM Axios')
  })
})
github vuex-orm / plugin-graphql / test / support / helpers.ts View on Github external
export function createStore(entities: Array, headers?: any, adapter?: Adapter) {
  const database = new Database();

  entities.forEach(entity => {
    database.register(entity.model, entity.module || {});
  });

  // @ts-ignore
  const executableSchema = makeExecutableSchema({
    typeDefs,
    resolvers
  });

  link = new SchemaLink({ schema: executableSchema });

  VuexORM.use(VuexORMGraphQLPlugin, {
    database: database,
    link,
    headers,
    adapter
  });

  const store = new Vuex.Store({
    plugins: [VuexORM.install(database)]
  });

  return [store, VuexORMGraphQLPlugin.instance];
}
github ictsc / ictsc-score-server / ui / plugins / vuex-orm.js View on Github external
}
}

const database = new Database()
Object.values(orm)
  .filter(model => !!model.entity)
  .forEach(model => database.register(model))

const options = {
  adapter: new CustomAdapter(),
  apolloClient,
  database,
  debug: process.env.NODE_ENV !== 'production'
}

VuexORM.use(VuexORMGraphQLPlugin, options)

export default ({ store }, inject) => {
  VuexORM.install(database)(store)

  // 主にデバッグ用
  inject('orm', orm)
}

@vuex-orm/core

The Vuex plugin to enable Object-Relational Mapping access to the Vuex Store.

MIT
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis