Skip to content

Commit

Permalink
fix: move mounted logic to prefetch to set query values
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Bedon committed Apr 29, 2024
1 parent 8d07393 commit d77175e
Showing 1 changed file with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ export default {
};
},
inject: ['apollo', 'cookieStore'],
preFetch(config, client) {
return client.query({ query: amountToLendQuery });
apollo: {
query: amountToLendQuery,
preFetch: true,
result({ data }) {
this.amountToLend = data?.my?.depositIncentiveAmountToLend ?? 0;
this.isLoggedin = !!data?.my?.id ?? false;
},
},
computed: {
promoBannerContent() {
Expand All @@ -50,13 +55,5 @@ export default {
};
}
},
mounted() {
const userInfo = this.apollo.readQuery({
query: amountToLendQuery,
});
this.amountToLend = userInfo?.my?.depositIncentiveAmountToLend ?? 0;
this.isLoggedin = !!userInfo?.my?.id ?? false;
}
};
</script>

0 comments on commit d77175e

Please sign in to comment.