-
-
Save andresmijares/7d73b3585efaf8e30ec7c84041e8cc81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Model, Data} from 'models' | |
import store from 'pathToReduxStore' | |
import {firebaseService, pouchDBService, mixpanelService} from 'services' | |
/* services are also singletons */ | |
class Orders extend Model { | |
constructor (reduxStore, Data, ...services) { | |
super(reduxStore, services) | |
this._store = reduxStore | |
} | |
create (order) { | |
let normalized = Data.normalizeToStore(order) | |
/* we can pass as much arguments as needed for each services, if the service it's not expecting a argument, it will just ignore it */ | |
this.asyncOperation('create', normalized) | |
} | |
} | |
/* This export a singleton */ | |
export let orders = new Orders(store, Data, firebaseService, pouchDBService, mixpanelService) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment