Skip to content

Instantly share code, notes, and snippets.

View acacha's full-sized avatar

Sergi Tur Badenas acacha

View GitHub Profile
export default {
snackbarShow: state => state.show,
snackbarColor: state => state.color,
snackbarText: state => state.text,
snackbarSubtext: state => state.subText,
snackbarTimeout: state => state.timeout
}
import * as mutations from '../../mutation-types'
import * as actions from '../../action-types'
import auth from '../../../api/auth'
export default {
[ actions.LOGIN ] (context, credentials) {
return new Promise((resolve, reject) => {
auth.login(credentials).then(response => {
context.commit(mutations.LOGGED, true)
resolve(response)
// AUTH MODULE
export const LOGIN = 'LOGIN'
export const LOGOUT = 'LOGOUT'
export const REGISTER = 'REGISTER'
export const REMEMBER_PASSWORD = 'REMEMBER_PASSWORD'
export const RESET_PASSWORD = 'RESET_PASSWORD'
// USERS MODULE
export const FETCH_USERS = 'FETCH_USERS'
export const UPDATE_USER = 'UPDATE_USER'
export default (ms) => {
return new Promise((resolve,reject) => {
setTimeout(() => {
resolve()
}, ms)
})
}
import axios from 'axios'
export default {
login (credentials) {
return axios.post('/login', credentials)
},
logout () {
return axios.post('/logout')
},
register (user) {
<template>
<v-avatar class="mt-1 mb-1" :size="size" >
<img :src="gravatarURL(user.email)" alt="avatar">
</v-avatar>
</template>
<style>
</style>
import * as mutations from '../../store/mutation-types'
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters([
'snackbarTimeout'
])
},
methods: {
import gravatar from 'gravatar'
export default {
methods: {
gravatarURL (email) {
return gravatar.url(email)
}
}
}
@acacha
acacha / boostrap.js
Created April 16, 2018 15:46
Laravel resources/assets/js/bootstrap.js File with Vuetify
/**
* We'll load the axios HTTP library which allows us to easily issue requests
* to our Laravel back-end. This library automatically handles sending the
* CSRF token as a header based on the value of the "XSRF" token cookie.
*/
window.axios = require('axios');
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
@acacha
acacha / app.js
Created April 16, 2018 15:43
Laravel resources/assets/js/app.js file with Vuetify and Vuex with Auth scaffolding components
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting point when
* building robust, powerful web applications using Vue and Laravel.
*/
require('./bootstrap');
window.Vue = require('vue');