Skip to content

Instantly share code, notes, and snippets.

@storuky
Last active December 27, 2018 10:29
Show Gist options
  • Save storuky/cca1123185c002562945ef6f2dddc6f1 to your computer and use it in GitHub Desktop.
Save storuky/cca1123185c002562945ef6f2dddc6f1 to your computer and use it in GitHub Desktop.
// api.js
export const GetAllProjects = () => Vue.http.get('/swage/v1/projects')
// resources/Project.js
import Vue from 'vue';
export default Vue.resource(
"swage/v1/projects{/id}",
{},//headers
{}//custom methods
)
// resources/index.js
import Project from './Project'
export { Project }
// And use like
import { Project } from '@/resources'
Project.get({id: 1})
Project.query()
Project.save({project: {...}})
Project.update({id: 1}, {project: {...}})
Project.delete({id: 1})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment