Remove RSVP from kredits service

Just native Promise will do.
This commit is contained in:
2020-05-29 13:11:36 +02:00
parent c491f10ec3
commit bf6d9dbc31
+3 -4
View File
@@ -1,6 +1,5 @@
import ethers from 'ethers'; import ethers from 'ethers';
import Kredits from 'kredits-contracts'; import Kredits from 'kredits-contracts';
import RSVP from 'rsvp';
import Service from '@ember/service'; import Service from '@ember/service';
import EmberObject from '@ember/object'; import EmberObject from '@ember/object';
@@ -90,7 +89,7 @@ export default Service.extend({
getEthProvider () { getEthProvider () {
let ethProvider; let ethProvider;
return new RSVP.Promise(async (resolve) => { return new Promise(async (resolve) => {
function instantiateWithoutAccount () { function instantiateWithoutAccount () {
console.debug('[kredits] Creating new instance from npm module class'); console.debug('[kredits] Creating new instance from npm module class');
console.debug(`[kredits] providerURL: ${config.web3ProviderUrl}`); console.debug(`[kredits] providerURL: ${config.web3ProviderUrl}`);
@@ -323,14 +322,14 @@ export default Service.extend({
getCurrentUser: computed('kredits.provider', 'currentUserAccounts.[]', function() { getCurrentUser: computed('kredits.provider', 'currentUserAccounts.[]', function() {
if (isEmpty(this.currentUserAccounts)) { if (isEmpty(this.currentUserAccounts)) {
return RSVP.resolve(); return Promise.resolve();
} }
return this.kredits.Contributor return this.kredits.Contributor
.functions.getContributorIdByAddress(this.currentUserAccounts.firstObject) .functions.getContributorIdByAddress(this.currentUserAccounts.firstObject)
.then((id) => { .then((id) => {
// check if the user is a contributor or not // check if the user is a contributor or not
if (id === 0) { if (id === 0) {
return RSVP.resolve(); return Promise.resolve();
} else { } else {
return this.kredits.Contributor.getById(id); return this.kredits.Contributor.getById(id);
} }