Skip to content

Commit

Permalink
change for showing amount as DCR instead of atoms (decred#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
vctt94 authored and dajohi committed Apr 12, 2018
1 parent cbca827 commit 4fe9ec7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion mocks/api/v1/user/me/GET.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"userid": 0,
"haspaid": true,
"paywalladdress":"TsgN9uAYfKdv3JKcqgGrFNjq7vUNZ4UDeu3",
"paywallamount":"0.1"
"paywallamount":"10000000"
}
16 changes: 12 additions & 4 deletions src/selectors/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,18 @@ export const paywallAddress = or(
compose(get("paywalladdress"), apiMeResponse),
);

export const paywallAmount = or(
compose(get("paywallamount"), apiNewUserResponse),
compose(get("paywallamount"), apiMeResponse),
);
export const paywallAmount = state => {
let paywallAmount = 0;
if(state.api.newUser && state.api.newUser.response) {
paywallAmount = state.api.newUser.response.paywallamount;
}
else if(state.api.me && state.api.me.response) {
paywallAmount = state.api.me.response.paywallamount;
}

// Amount returned from the server is in atoms, so convert to dcr.
return paywallAmount / 100000000;
};

export const isTestNet = bool(
(state) => {
Expand Down

0 comments on commit 4fe9ec7

Please sign in to comment.