0bdb4d2021
In case there's a wallet available, ask the user to connect it and fill in their account address in the form field. Also, check the status code when submitting it to the back-end and show an error message instead of the success/completion page in case the contributor could not be created.
24 lines
589 B
JavaScript
24 lines
589 B
JavaScript
import Route from '@ember/routing/route';
|
|
import { inject as service } from '@ember/service';
|
|
import { isEmpty } from '@ember/utils';
|
|
|
|
export default class SignupAccountRoute extends Route {
|
|
@service kredits;
|
|
|
|
async setupController (controller) {
|
|
if (!window.ethereum) return;
|
|
|
|
if (this.kredits.hasAccounts) {
|
|
controller.accountAddress = this.kredits.currentUserAccounts.firstObject;
|
|
} else {
|
|
return this.kredits.connectWallet();
|
|
}
|
|
}
|
|
|
|
redirect () {
|
|
if (isEmpty(this.kredits.githubAccessToken)) {
|
|
this.transitionTo('signup.index');
|
|
}
|
|
}
|
|
}
|