Created
May 30, 2018 14:53
-
-
Save colevandersWands/8b2228b32e115e5ad4dc0ab79afff589 to your computer and use it in GitHub Desktop.
state store starter
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
var store = { | |
debug: true, | |
nextID: 0, | |
state: {}, | |
create (newArtist) { | |
if (this.debug) console.log('created new artist: ' + newArtist); | |
// create | |
// call to backend | |
}, | |
read_one (id) { | |
if (this.debug) console.log('read artist: ' + id); | |
// read one locally (from state) | |
}, | |
read_all () { | |
// read all from backend and update state | |
}, | |
update (id, newArtist) { | |
if (this.debug) console.log('updated artist ' + id + ' with: ' + newArtist) | |
// call to backend | |
// update state to match backend | |
}, | |
remove (id) { | |
// remove it locally, and sync to backend | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment