Skip to content

Instantly share code, notes, and snippets.

@jamosaur
Created October 20, 2016 10:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamosaur/1b1ca2b47438d0fb31dc6fe82c99c9aa to your computer and use it in GitHub Desktop.
Save jamosaur/1b1ca2b47438d0fb31dc6fe82c99c9aa to your computer and use it in GitHub Desktop.

Edit Variables

CAPGET: capitalize(GET)

import Api from './../../api';
export default {
props: [],
mixins: [],
components: {},
data: function () {
return {
$GET$s: {},
$GET$: {},
edit$CAPGET$: {},
}
},
ready () {
},
computed: {},
methods: {
get$CAPGET$s() {
Api.$CAPGET$.getAll().then((resp) => {
if(!Api.isResponseValid(resp)) {
throw (resp);
}
this.$GET$ = resp.data.$GET$;
}).catch((resp) => {
console.log('ee', resp);
});
},
get$CAPGET$() {
Api.$CAPGET$.get({id: this.id}).then((resp) => {
if(!Api.isResponseValid(resp)) {
throw (resp);
}
this.$GET$ = resp.data.$GET$;
}).catch((resp) => {
console.log('ee', resp);
});
},
create$CAPGET$() {
let new$CAPGET$ = {
},
Api.$CAPGET$.create(new$CAPGET$).then((resp) => {
if(!Api.isResponseValid(resp)) {
throw (resp);
}
// Do stuff with response
}).catch((resp) => {
console.log('ee', resp);
});
},
edit$CAPGET$() {
let $GET$ = {
},
Api.$CAPGET$.update({id: this.id}, $GET$).then((resp) => {
if(!Api.isResponseValid(resp)) {
throw (resp);
}
// Do stuff with response
}).catch((resp) => {
console.log('ee', resp);
});
},
delete$CAPGET$() {
Api.$CAPGET$.delete({id: this.id}).then((resp) => {
if(!Api.isResponseValid(resp)) {
throw (resp);
}
// Do stuff with response
}).catch((resp) => {
console.log('ee', resp);
})
}
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment