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,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
})
}); });
} }
} }