Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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')
})
})
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,
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];
}
import { Database } from '@vuex-orm/core';
export const VuexOrmPluginConfig = {
/**
* Default VuexORM Database
* @param {Database} Instance of VuexORM database
*/
database: new Database(),
/**
* @param {string} Default DataStore prefix
*/
name: 'vuex', // Keep for backward compatibilities
/**
* @param {object} localforage config
*/
localforage: {
name: 'vuex',
},
/**
*
*/
}
}
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)
}
export default ({ store }, inject) => {
VuexORM.install(database)(store)
// 主にデバッグ用
inject('orm', orm)
}
it('can register axios instance directly to the model', () => {
VuexORM.use(VuexORMAxios)
Model.setAxios(axios)
expect(Model.axios).toBe(axios)
})
it('registeres axios instance by passing to plugin install option', () => {
VuexORM.use(VuexORMAxios, { axios })
expect(Model.axios).toBe(axios)
})
it('can register axios instance directly to the model', () => {
VuexORM.use(VuexORMAxios)
Model.setAxios(axios)
expect(Model.axios).toBe(axios)
})
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];
}