Skip to content

Instantly share code, notes, and snippets.

View vertcitron's full-sized avatar

Stéphane Souron vertcitron

View GitHub Profile
const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const { execSync } = require('child_process')
process.env.VUE_APP_VERSION = require('./package.json').version
process.env.VUE_APP_GIT_BRANCH = process.env.CI_BRANCH || execSync('git rev-parse --abbrev-ref HEAD').toString('utf8').trim()
module.exports = {
outputDir: 'public',
assetsDir: 'static',
@vertcitron
vertcitron / example_api.csv
Created November 2, 2018 09:52
article "Making a large scale app with vue.js (part 1)"
url method description
/user GET retrieves logged user infos
/user PUT modifies logged user infos
/user DELETE deconnects current user and deletes it
/user POST creates a new user (no need to be logged in)
/user/login POST submits user's credentials and logs in if succeeded
/user/logout POST deconnects curent user
/todos GET retrieve all todos for the current user
/todos/id GET retrieves data for a single todo
/** VUEX module for todos management in todolist app **/
export default {
namespaced: true,
// -----------------------------------------------------------------
state: {
// properties to store todos data
},
// -----------------------------------------------------------------
getters: {
/** VUEX store definition file for todo list app **/
import Vue from 'vue'
import Vuex from 'vuex'
import userModule from './userModule'
import todosModule from './todosModule'
Vue.use(Vuex)
// get logged in user infos :
const user = this.$store.getters['user/data']
// register a new user to the backend :
this.$store.dispatch('user/create', newUser)
// modify a todo :
this.$store.dispatch('todos/update', modifiedTodo)
// etc...
{
"data": {
"id": "5a6f5029d0eea73a41398812",
"type": "image",
"title": "My image",
"timestamps": {
"created": "2018-02-19 13:20:00",
"uploaded": "2018-02-19 13:20:00",
"modified": "2018-02-19 13:20:00"
},
/** VUEX module for image asset management **/
import Vue from 'vue'
export default {
namespaced: true,
// -----------------------------------------------------------------
state: {
asset: {}
},
/** VUEX module for image asset management **/
import Vue from 'vue'
export default {
namespaced: true,
// -----------------------------------------------------------------
state: {
asset: {}
},
/** VUEX module for image asset management **/
import Vue from 'vue'
export default {
namespaced: true,
// -----------------------------------------------------------------
state: {
asset: {}
},
const originalSlot = this.$store.getters['asset/slot']('original')
originalSlot.public_url = 'some new url'
this.$store.commit('asset/setSlot', this.originalSlot)