Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Vue.js 2 Web Development Projects

You're reading from   Vue.js 2 Web Development Projects Learn Vue.js by building 6 web apps

Arrow left icon
Product type Paperback
Published in Nov 2017
Publisher Packt
ISBN-13 9781787127463
Length 398 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
 GUILLAUME GUILLAUME
Author Profile Icon GUILLAUME
GUILLAUME
Arrow right icon
View More author details
Toc

Support tickets


In this last part, we will create an authenticated section of our app, where the user will be able to add and view support tickets. All the necessary requests are available on the server you already downloaded and if you are curious about how this has been done in the node with passport.js, you can take a look at the sources!

User authentication

In this first section, we will take care of the user system of our app. We will have both login and sign up components, to be able to create new users.

Storing the user in a centralized state

We will store the user data inside a state object like we did in Chapter 3, Project 2 - Castle Duel Browser Game, so we can access it in any component of the app:

  1. Create a new state.js file next to main.js, which exports the state object:
      export default {
        user: null,
      }

The user property will be null when no user is logged in, or else it will contain the user data.

  1. Then, in the main.js file, import the state:
      import state from...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime
Visually different images