Skip to content
InfinityKnow

InfinityKnow

Infinity Knowledge (IK) : Technology, Articles, Topics, Facts or many More.

  • Home
  • Education
    • yttags
    • Make Money
    • Jobs
    • Programming
      • Technology
      • Web Design
      • WEB HOSTING
      • Interview
  • Entertainment
    • pakainfo
    • Sports
    • Tips and Tricks
      • Law
      • Photography
      • Travel
  • Health
    • Insurance
    • Lifestyle
      • Clothing
      • Fashion
      • Food
  • News
    • Insurance
      • Auto Car Insurance
      • Business Insurance
    • Donate
    • California
  • News
    • Political
  • Home Improvement
  • Trading
    • Marketing
    • Top Tranding
    • Business
    • Real Estate
  • Full Form
  • Contact Us
  • Quotes about love Quotes
  • Kheerganga
    Kheerganga The perfect Holiday Place Photography
  • Top Angular2 Interview Questions and answers
    Top Angular2 Interview Questions and answers Technology
  • Happy birthday shayari Shayari
  • AngularJS Controllers Inheritance – angular inherits Example
    AngularJS Controllers Inheritance – angular inherits Example Technology
  • Angular ng-app directive Example Technology
  • smps full form – smps Kya Hai, Meaning and Abbreviation – What is the full form of smps? full form
  • Mlk quotes Quotes
vuejs Authentication – vue sessionstorage and localstorage

vuejs Authentication – vue sessionstorage and localstorage

Posted on July 8, 2018July 9, 2018 By admin No Comments on vuejs Authentication – vue sessionstorage and localstorage

vuejs Authentication – vue sessionstorage and localstorage

Vuejs Session All Method

  • this.$session.getAll() , In vuejs Functions,returns all Simple data stored in the Vuejs Session.
  • this.$session.set(key,value), sets a single Simple value to the Vuejs Session.
  • this.$session.get(key),returns the value Simple attributed to the given key.
  • this.$session.start() , In vuejs Functions, initializes a Vuejs session with a ‘session-id’. If you attempt to save a Simple value without having started a new Vuejs session, the simple plugin will Simple automatically start a new Vuejs session.
  • this.$session.exists() , In vuejs Functions,checks whether a Vuejs session has been simple initialized or not.
  • this.$session.has(key),checks whether the simple key exists in the Vuejs Session
  • this.$session.remove(key),removes the given simple key from the Session
  • this.$session.clear() , In vuejs Functions, clear all keys in the Vuejs Session, except for ‘session-id’, simple keeping the Vuejs Session alive
  • this.$session.destroy() , In vuejs Functions, destroys the Vuejs Session
  • this.$session.id() , In vuejs Functions,returns the Simple ‘session-id’
READ :  PHP mysql with Connecting to Database Using AngularJS

vuejs state management Example

here in this example show you localstorage,sessionStorage and cookies in javascript and then retrieve web services.

[php]
// init param
export default {
name: ‘login’,
//call this method login function
methods: {
login: function () {
this.$http.post(‘https://infinityknow.com/user/login’, {
password: this.password, // set password
email: this.email // set email address
}).then(function (response) {
// check conditions
if (response.status === 200 && ‘token’ in response.body) {
this.$session.start() // start the session
this.$session.set(‘jwt’, response.body.token)
// Bearer token get and pass router
Vue.http.headers.common[‘Authorization’] = ‘Bearer ‘ + response.body.token
this.$router.push(‘/panel/search’)
}
}, function (err) {
console.log(‘err’, err)
})
}
}
}

[/php]

Vuejs Logout Method Calling

[php]
export default {
//init name all
name: ‘panel’,
data () {
return { }
},
//call the function
beforeCreate: function () {
if (!this.$session.exists()) { // check conditions
this.$router.push(‘/’)
}
},
//call this method logout
methods: {
logout: function () {
this.$session.destroy()//session destroy here
this.$router.push(‘/’) // router using vuejs
}
}
}
[/php]

READ :  vue js Login Form get http json data

Example

Related posts:

  1. Vuejs Simple Navigation Menu vue router-link params
  2. Angular Session localStorage and sessionStorage
  3. vuejs toggle class – vue js v-class – Dynamic Components in Vuejs
  4. Vuejs Simple Tooltip Plugin v-tooltip Example
Technology, MySQL, PHP, VueJs Tags:laravel vue.js authentication, vue js authentication tutorial, vue localstorage, vue router auth, vue-auth tutorial, vue-authenticate, vue-authenticate example, vue.js 2 authentication

Post navigation

Previous Post: Angularjs get last item Array Object and json Example
Next Post: AngularJS Custom Directives example – Angular Directives

Related Posts

  • Laravel 6 FirstorCreate Increment and update column using Eloquent Technology
  • Overview of Implement Stack Algorithm in C#.Net Technology
  • vue js Login Form get http json data
    vue js Login Form get http json data Technology
  • Query String Angular
    Query String Angular with Parameters Technology
  • VueJS Dynamically add CSS Class
    VueJS Dynamically add CSS Class VueJs
  • Angular Multi Select Drop Down Options Technology

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Account web hosting (1)
  • AngularJs (277)
  • Articles (143)
  • Asp.Net (49)
  • Astrology (2)
  • Attorney (7)
  • Auto Car Insurance (4)
  • Biography (2)
  • Business (9)
  • Business Insurance (3)
  • California (4)
  • Choose the web hosting (1)
  • Clothing (6)
  • cloud (8)
  • Cloud data storage (2)
  • Credit (1)
  • Dedicated hosting server web (1)
  • Dedicated server web hosting (1)
  • Dedicated web hosting (1)
  • Degree (11)
  • Design (9)
  • Differences shared hosting (1)
  • Donate (2)
  • Education (37)
  • Energy web hosting (1)
  • Entertainment (6)
  • Facts (12)
  • Fashion (3)
  • Finance (3)
  • Food (5)
  • full form (90)
  • Google Adsense (22)
  • Health (20)
  • Home Improvement (5)
  • Insurance (6)
  • Interview (2)
  • Jobs (6)
  • jquery (2)
  • jQuery (2)
  • Laravel (164)
  • Lawyer (4)
  • Lifestyle (6)
  • Loans (6)
  • Make Money (31)
  • Managed dedicated server (1)
  • Managed hosting solution (1)
  • Managed servers (1)
  • Marketing (8)
  • Mortgage (2)
  • Movies (21)
  • MySQL (180)
  • News (5)
  • Photography (1)
  • PHP (250)
  • Programming (18)
  • Quotes (75)
  • Real Estate (2)
  • SEO (9)
  • Shared web hosting (1)
  • Shayari (67)
  • Sports (5)
  • Status (34)
  • Stories (45)
  • suvichar (8)
  • Tech (3)
  • Technology (675)
  • Tips and Tricks (42)
  • Top Tranding (35)
  • Trading (28)
  • Travel (12)
  • Uncategorized (8)
  • VueJs (179)
  • Web Design (2)
  • WEB HOSTING (1)
  • Web hosting company (1)
  • Web hosting really (1)
  • Web hosting windows (1)
  • Which website hosting (1)
  • Wishes (13)
  • wordpress (15)

Categories

AngularJs (277) Articles (143) Asp.Net (49) Attorney (7) Business (9) Clothing (6) cloud (8) Degree (11) Design (9) Education (37) Entertainment (6) Facts (12) Food (5) full form (90) Google Adsense (22) Health (20) Home Improvement (5) Insurance (6) Jobs (6) Laravel (164) Lifestyle (6) Loans (6) Make Money (31) Marketing (8) Movies (21) MySQL (180) News (5) PHP (250) Programming (18) Quotes (75) SEO (9) Shayari (67) Sports (5) Status (34) Stories (45) suvichar (8) Technology (675) Tips and Tricks (42) Top Tranding (35) Trading (28) Travel (12) Uncategorized (8) VueJs (179) Wishes (13) wordpress (15)
  • Dynamically Set navbar active tab angularjs ngclass
    Dynamically Set navbar active tab angularjs ngclass Technology
  • FIFA World Cup Russia 2018 Latest News
    Shayari Shayari
  • Bootstrap Toggle switch with Vuejs ajax update to mysql in PHP
    Bootstrap Toggle switch with Vuejs ajax update to mysql in PHP Technology
  • vuejs Check All Uncheck All checkboxes
    vuejs Check All Uncheck All checkboxes Technology
  • Rahat indori shayari
    Rahat indori shayari Shayari
  • Ignore duplicate record on insert using Laravel 6 Technology
  • Angular Top 10 Interview Questions Technology
  • The USA's Best Mesothelioma Lawyer asbestos exposure attorneys
    The USA’s Best Mesothelioma Lawyer asbestos exposure attorneys Articles

Copyright © 2022 InfinityKnow.

Powered by PressBook News WordPress theme