[O] Only clear cookies if cookies exists
This commit is contained in:
@@ -24,18 +24,18 @@ export default class Login extends Vue
|
|||||||
*/
|
*/
|
||||||
public created()
|
public created()
|
||||||
{
|
{
|
||||||
// Check cookies version
|
|
||||||
if (this.needToUpdateCookies())
|
|
||||||
{
|
|
||||||
console.log('Version Updated! Clearing cookies...');
|
|
||||||
|
|
||||||
// Clear all cookies
|
|
||||||
this.$cookies.keys().forEach(key => this.$cookies.remove(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check login cookies
|
// Check login cookies
|
||||||
if (this.$cookies.isKey('va.token'))
|
if (this.$cookies.isKey('va.token'))
|
||||||
{
|
{
|
||||||
|
// Check cookies version
|
||||||
|
if (this.needToUpdateCookies())
|
||||||
|
{
|
||||||
|
console.log('Version Updated! Clearing cookies...');
|
||||||
|
|
||||||
|
// Clear all cookies
|
||||||
|
this.$cookies.keys().forEach(key => this.$cookies.remove(key));
|
||||||
|
}
|
||||||
|
|
||||||
// Already contains valid token / TODO: Validate
|
// Already contains valid token / TODO: Validate
|
||||||
this.$emit('login:token', this.$cookies.get('va.token'));
|
this.$emit('login:token', this.$cookies.get('va.token'));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user