Commit 15839213 authored by Adrian's avatar Adrian

cookies

parent a0eae63e
......@@ -76,13 +76,13 @@ export default {
mounted() {
this.$nextTick(async () => {
const keyCookie = process.env.VUE_APP_KEY_COOKIE || 'base.token';
if ((this.getCookie('base.token') || '').length > 0) {
if ((this.getCookie(keyCookie) || '').length > 5) {
try {
const request = {
method: 'GET',
url: `${this.$baseServer}usuarios/profile`,
headers: {
Authorization: `Bearer ${this.getCookie('base.token')}`
Authorization: `Bearer ${this.getCookie(keyCookie)}`
}
};
let credentials = await axios(request);
......@@ -90,11 +90,11 @@ export default {
data: {
datos: {
...credentials.data.datos,
access_token: this.getCookie('base.token')
access_token: this.getCookie(keyCookie)
}
}
};
this.setCookie('base.token', -1);
this.setCookie(keyCookie, -1);
document.cookie = `${keyCookie}=; Path=/;`;
this.credentials(null, null, credentials.data);
} catch (err) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment