@@ -2,7 +2,7 @@ import Model from './model';
22import { ApolloClient , FetchPolicy } from 'apollo-client' ;
33import { HttpLink } from 'apollo-link-http' ;
44import { InMemoryCache } from 'apollo-cache-inmemory' ;
5- import { Data , ActionParams , Arguments , DispatchFunction , PatchedModel } from './interfaces' ;
5+ import { Data , ActionParams , Arguments , DispatchFunction , PatchedModel } from './interfaces' ;
66import QueryBuilder from './queryBuilder' ;
77import { upcaseFirstLetter } from './utils' ;
88import Context from './context' ;
@@ -74,53 +74,43 @@ export default class VuexORMApollo {
7474 this . context . components . subActions . destroy = this . destroy . bind ( this ) ;
7575 this . context . components . subActions . mutate = this . customMutation . bind ( this ) ;
7676
77-
7877 // Register static model convenience methods
79- ( this . context . components . Model as ( typeof PatchedModel ) ) . fetch = async function ( filter : any , bypassCache = false ) {
78+ ( this . context . components . Model as ( typeof PatchedModel ) ) . fetch = async function ( filter : any , bypassCache = false ) {
8079 let filterObj = filter ;
8180 if ( typeof filterObj !== 'object' ) filterObj = { id : filter } ;
8281 return this . dispatch ( 'fetch' , { filter : filterObj , bypassCache } ) ;
8382 } ;
8483
85- ( this . context . components . Model as ( typeof PatchedModel ) ) . mutate = async function ( params : any ) {
84+ ( this . context . components . Model as ( typeof PatchedModel ) ) . mutate = async function ( params : any ) {
8685 return this . dispatch ( 'mutate' , params ) ;
8786 } ;
8887
89-
9088 // Register model convenience methods
91- this . context . components . Model . prototype . $mutate = async function ( params : any ) {
89+ this . context . components . Model . prototype . $mutate = async function ( params : any ) {
9290 if ( ! params [ 'id' ] ) params [ 'id' ] = this . id ;
9391 return this . $dispatch ( 'mutate' , params ) ;
9492 } ;
9593
96- this . context . components . Model . prototype . $persist = async function ( args : any ) {
94+ this . context . components . Model . prototype . $persist = async function ( args : any ) {
9795 return this . $dispatch ( 'persist' , { id : this . id , args } ) ;
9896 } ;
9997
100- this . context . components . Model . prototype . $push = async function ( args : any ) {
98+ this . context . components . Model . prototype . $push = async function ( args : any ) {
10199 return this . $dispatch ( 'push' , { data : this , args } ) ;
102100 } ;
103101
104- this . context . components . Model . prototype . $destroy = async function ( ) {
102+ this . context . components . Model . prototype . $destroy = async function ( ) {
105103 return this . $dispatch ( 'destroy' , { id : this . id } ) ;
106104 } ;
107105
108- this . context . components . Model . prototype . $deleteAndDestroy = async function ( ) {
106+ this . context . components . Model . prototype . $deleteAndDestroy = async function ( ) {
109107 await this . $delete ( ) ;
110108 return this . $destroy ( ) ;
111109 } ;
112110
113111 // this.components.subActions.destroyAll = this.destroyAll.bind(this);
114112 }
115113
116-
117- /**
118- * Helper to dispatch actions on the store
119- */
120- public dispatch ( params : ActionParams ) {
121-
122- }
123-
124114 /**
125115 * Will be called, when dispatch('entities/something/fetch') is called.
126116 *
0 commit comments