diff --git a/src/components/ControlBar.vue b/src/components/ControlBar.vue index d4456a9..d096d0c 100644 --- a/src/components/ControlBar.vue +++ b/src/components/ControlBar.vue @@ -182,10 +182,9 @@ export default { this.$emit(`user_id`, data.id); }).catch((err) => { - console.error(err) - window.location.hash = ``; - window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;; - return + if (err.status == 401) { + this.auth_expired(); + }; }) }; }); diff --git a/src/components/MainView.vue b/src/components/MainView.vue index 7780499..09fa4ae 100644 --- a/src/components/MainView.vue +++ b/src/components/MainView.vue @@ -82,7 +82,10 @@ export default { this.config = config; this.data = response.data.items; }).catch((err) => { - this.error = `${err.name}: ${err.message}` + this.error = `${err.name}: ${err.message}`; + if (err.status == 401) { + this.auth_expired(); + }; }); }, } diff --git a/src/components/modals/DetailedTrack.vue b/src/components/modals/DetailedTrack.vue index c35a011..fc6cb6d 100644 --- a/src/components/modals/DetailedTrack.vue +++ b/src/components/modals/DetailedTrack.vue @@ -103,7 +103,11 @@ export default { }; this.data_populated = true; }) - .catch(err => console.error(err)) + .catch(err => { + if (err.status == 401) { + this.auth_expired(); + }; + }); }) }, computed: { diff --git a/src/components/modals/PlaylistExport.vue b/src/components/modals/PlaylistExport.vue index c0607fa..07a90f9 100644 --- a/src/components/modals/PlaylistExport.vue +++ b/src/components/modals/PlaylistExport.vue @@ -136,10 +136,9 @@ export default { this.populate_playlist() }) .catch((err) => { - console.error(err) - window.location.hash = ``; - window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;; - return + if (err.status == 401) { + this.auth_expired(); + }; }) }, populate_playlist() { @@ -162,10 +161,9 @@ export default { this.success = true; }) .catch((err) => { - console.error(err) - window.location.hash = ``; - window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;; - return; + if (err.status == 401) { + this.auth_expired(); + }; }) }, },