0
0
Fork 0

Prevent attempt at getting profile data when in dev or preview mode

This commit is contained in:
Oliver-Akins 2020-08-14 00:21:17 -06:00
parent fe333b2b4d
commit 8913b377e6

View file

@ -168,15 +168,16 @@ export default {
}, },
mounted: function() { mounted: function() {
this.$nextTick(function() { this.$nextTick(function() {
if (!(this.preview || this.dev)) {
axios.get( axios.get(
`${this.api_url}/me`, `${this.api_url}/me`,
{ headers: { Authorization: `Bearer ${this.api_token}` } } { headers: { Authorization: `Bearer ${this.api_token}` } }
).then((response) => { ).then((response) => {
if (response.error) { if (response.error && !(this.preview || this.dev)) {
window.location.hash = ``; window.location.hash = ``;
window.location.href = `${this.auth_redirect}?error=${encodeURI(response.error)}`; window.location.href = `${this.auth_redirect}?error=${encodeURI(response.error)}`;
return return;
} };
let data = response.data; let data = response.data;
// Set the Vue user object // Set the Vue user object
@ -189,6 +190,7 @@ export default {
window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;; window.location.href = `${this.auth_redirect}?error=${encodeURI(err)}`;;
return return
}) })
};
}); });
} }
} }