Connect wallet and fill in address during signup
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.
This commit is contained in:
@@ -2,16 +2,22 @@ import Route from '@ember/routing/route';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
|
||||
export default Route.extend({
|
||||
export default class SignupAccountRoute extends Route {
|
||||
@service kredits;
|
||||
|
||||
kredits: service(),
|
||||
async setupController (controller) {
|
||||
if (!window.ethereum) return;
|
||||
|
||||
if (this.kredits.hasAccounts) {
|
||||
controller.accountAddress = this.kredits.currentUserAccounts.firstObject;
|
||||
} else {
|
||||
return this.kredits.connectWallet();
|
||||
}
|
||||
}
|
||||
|
||||
redirect () {
|
||||
this._super(...arguments);
|
||||
|
||||
if (isEmpty(this.kredits.githubAccessToken)) {
|
||||
this.transitionTo('signup.index');
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user