Accept the error object in the auth expiration function
This commit is contained in:
parent
5ad272eccb
commit
319370a3ff
5 changed files with 16 additions and 12 deletions
|
|
@ -182,8 +182,8 @@ export default {
|
||||||
this.$emit(`user_id`, data.id);
|
this.$emit(`user_id`, data.id);
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
if (err.status == 401) {
|
if (err.response.status == 401) {
|
||||||
this.auth_expired();
|
return this.auth_expired(err);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -83,8 +83,8 @@ export default {
|
||||||
this.data = response.data.items;
|
this.data = response.data.items;
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
this.error = `${err.name}: ${err.message}`;
|
this.error = `${err.name}: ${err.message}`;
|
||||||
if (err.status == 401) {
|
if (err.response.status == 401) {
|
||||||
this.auth_expired();
|
return this.auth_expired(err);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,8 @@ export default {
|
||||||
this.data_populated = true;
|
this.data_populated = true;
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
if (err.status == 401) {
|
if (err.response.status == 401) {
|
||||||
this.auth_expired();
|
return this.auth_expired(err);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -136,8 +136,8 @@ export default {
|
||||||
this.populate_playlist()
|
this.populate_playlist()
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.status == 401) {
|
if (err.response.status == 401) {
|
||||||
this.auth_expired();
|
return this.auth_expired(err);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -161,8 +161,8 @@ export default {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err.status == 401) {
|
if (err.response.status == 401) {
|
||||||
this.auth_expired();
|
return this.auth_expired(err);
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,14 @@ Vue.mixin({
|
||||||
css_var(var_name) {
|
css_var(var_name) {
|
||||||
return getComputedStyle(document.documentElement).getPropertyValue(var_name);
|
return getComputedStyle(document.documentElement).getPropertyValue(var_name);
|
||||||
},
|
},
|
||||||
auth_expired() {
|
auth_expired(error = null) {
|
||||||
sessionStorage.removeItem(this.storage_key.token);
|
sessionStorage.removeItem(this.storage_key.token);
|
||||||
window.location.hash = ``;
|
window.location.hash = ``;
|
||||||
window.location.href = this.auth_redirect;
|
if (error) {
|
||||||
|
window.location.href = `${this.home_page}?error=${error}`;
|
||||||
|
} else {
|
||||||
|
window.location.href = this.home_page;
|
||||||
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue