November 2017
Beginner to intermediate
398 pages
8h 42m
English
When the page load and the application start, we need to check if the user is already connected. For this reason, the server has a /user path that returns the user object if they are logged in. We will put it in the global state just like if we logged in. Then, we will start the Vue app:
import VueFetch, { $fetch } from './plugins/fetch'
async function main () { // Get user info try { state.user = await $fetch('user') } catch (e) { console.warn(e) } // Launch app new Vue({ el: '#app', data: state, router, render: h => ...Read now
Unlock full access