Have catch blocks call the auth expire function
This commit is contained in:
parent
c9c1e57187
commit
ae5a697de5
4 changed files with 18 additions and 14 deletions
|
|
@ -182,10 +182,9 @@ export default {
|
||||||
this.$emit(`user_id`, data.id);
|
this.$emit(`user_id`, data.id);
|
||||||
|
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
console.error(err)
|
if (err.status == 401) {
|
||||||
window.location.hash = ``;
|
this.auth_expired();
|
||||||
window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;;
|
};
|
||||||
return
|
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,10 @@ export default {
|
||||||
this.config = config;
|
this.config = config;
|
||||||
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) {
|
||||||
|
this.auth_expired();
|
||||||
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,11 @@ export default {
|
||||||
};
|
};
|
||||||
this.data_populated = true;
|
this.data_populated = true;
|
||||||
})
|
})
|
||||||
.catch(err => console.error(err))
|
.catch(err => {
|
||||||
|
if (err.status == 401) {
|
||||||
|
this.auth_expired();
|
||||||
|
};
|
||||||
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
||||||
|
|
@ -136,10 +136,9 @@ export default {
|
||||||
this.populate_playlist()
|
this.populate_playlist()
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err)
|
if (err.status == 401) {
|
||||||
window.location.hash = ``;
|
this.auth_expired();
|
||||||
window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;;
|
};
|
||||||
return
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
populate_playlist() {
|
populate_playlist() {
|
||||||
|
|
@ -162,10 +161,9 @@ export default {
|
||||||
this.success = true;
|
this.success = true;
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err)
|
if (err.status == 401) {
|
||||||
window.location.hash = ``;
|
this.auth_expired();
|
||||||
window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;;
|
};
|
||||||
return;
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue