Ember code updates

This commit is contained in:
Râu Cao
2023-08-14 17:50:10 +02:00
parent 3f080cf553
commit 0ecc4079c2
2 changed files with 9 additions and 14 deletions
+3 -6
View File
@@ -1,18 +1,15 @@
import Controller from '@ember/controller'; import Controller from '@ember/controller';
import { inject as service } from '@ember/service'; import { inject as service } from '@ember/service';
import { action } from '@ember/object'; import { action } from '@ember/object';
import { alias } from '@ember/object/computed';
import { tracked } from '@glimmer/tracking'; import { tracked } from '@glimmer/tracking';
import config from 'kredits-web/config/environment'; import config from 'kredits-web/config/environment';
import { isAddress } from 'web3-utils'; import { isAddress } from 'web3-utils';
export default class BudgetController extends Controller { export default class AccountController extends Controller {
@service kredits; @service kredits;
@tracked accountAddress = null; @tracked accountAddress = null;
@alias('kredits.githubAccessToken') githubAccessToken;
get isValidEthAccount () { get isValidEthAccount () {
return isAddress(this.accountAddress); return isAddress(this.accountAddress);
} }
@@ -24,7 +21,7 @@ export default class BudgetController extends Controller {
@action @action
completeSignup () { completeSignup () {
const payload = { const payload = {
accessToken: this.githubAccessToken, accessToken: this.kredits.githubAccessToken,
account: this.accountAddress account: this.accountAddress
} }
@@ -43,7 +40,7 @@ export default class BudgetController extends Controller {
} else { } else {
console.log('[signup/account] Created contributor:', data); console.log('[signup/account] Created contributor:', data);
this.githubAccessToken = null; this.kredits.githubAccessToken = null;
this.accountAddress = null; this.accountAddress = null;
this.transitionToRoute('signup.complete'); this.transitionToRoute('signup.complete');
+4 -6
View File
@@ -1,14 +1,12 @@
import Controller from '@ember/controller'; import Controller from '@ember/controller';
import { action } from '@ember/object';
import config from 'kredits-web/config/environment'; import config from 'kredits-web/config/environment';
export default Controller.extend({ export default class IndexController extends Controller {
actions: {
@action
connectGithub () { connectGithub () {
window.location = config.githubConnectUrl; window.location = config.githubConnectUrl;
} }
} }
});