Prevent attempt at getting profile data when in dev or preview mode
This commit is contained in:
parent
fe333b2b4d
commit
8913b377e6
1 changed files with 21 additions and 19 deletions
|
|
@ -168,27 +168,29 @@ export default {
|
||||||
},
|
},
|
||||||
mounted: function() {
|
mounted: function() {
|
||||||
this.$nextTick(function() {
|
this.$nextTick(function() {
|
||||||
axios.get(
|
if (!(this.preview || this.dev)) {
|
||||||
`${this.api_url}/me`,
|
axios.get(
|
||||||
{ headers: { Authorization: `Bearer ${this.api_token}` } }
|
`${this.api_url}/me`,
|
||||||
).then((response) => {
|
{ headers: { Authorization: `Bearer ${this.api_token}` } }
|
||||||
if (response.error) {
|
).then((response) => {
|
||||||
|
if (response.error && !(this.preview || this.dev)) {
|
||||||
|
window.location.hash = ``;
|
||||||
|
window.location.href = `${this.auth_redirect}?error=${encodeURI(response.error)}`;
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
let data = response.data;
|
||||||
|
|
||||||
|
// Set the Vue user object
|
||||||
|
this.user.name = data.display_name;
|
||||||
|
this.user.image = data.images.length > 0 ? data.images[0].url : ``;
|
||||||
|
|
||||||
|
}).catch((err) => {
|
||||||
|
console.error(err)
|
||||||
window.location.hash = ``;
|
window.location.hash = ``;
|
||||||
window.location.href = `${this.auth_redirect}?error=${encodeURI(response.error)}`;
|
window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;;
|
||||||
return
|
return
|
||||||
}
|
})
|
||||||
let data = response.data;
|
};
|
||||||
|
|
||||||
// Set the Vue user object
|
|
||||||
this.user.name = data.display_name;
|
|
||||||
this.user.image = data.images.length > 0 ? data.images[0].url : ``;
|
|
||||||
|
|
||||||
}).catch((err) => {
|
|
||||||
console.error(err)
|
|
||||||
window.location.hash = ``;
|
|
||||||
window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;;
|
|
||||||
return
|
|
||||||
})
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue