Handle undefined Github access token
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import Route from '@ember/routing/route';
|
import Route from '@ember/routing/route';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
|
|
||||||
export default Route.extend({
|
export default Route.extend({
|
||||||
|
|
||||||
@@ -8,7 +9,17 @@ export default Route.extend({
|
|||||||
redirect () {
|
redirect () {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
||||||
const accessToken = window.location.hash.match(/access_token=(.+)/)[1];
|
let accessToken;
|
||||||
|
try {
|
||||||
|
accessToken = window.location.hash.match(/access_token=(.+)/)[1];
|
||||||
|
} catch (error) { /* ignore */ }
|
||||||
|
|
||||||
|
if (isEmpty(accessToken) || accessToken === 'undefined') {
|
||||||
|
console.error('No GitHub access token found.');
|
||||||
|
this.transitionTo('signup');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.kredits.set('githubAccessToken', accessToken);
|
this.kredits.set('githubAccessToken', accessToken);
|
||||||
|
|
||||||
this.transitionTo('signup.eth-account');
|
this.transitionTo('signup.eth-account');
|
||||||
|
|||||||
Reference in New Issue
Block a user