aboutsummaryrefslogtreecommitdiff
path: root/src/Widget.tsx
diff options
context:
space:
mode:
authorMax Nanis2025-06-09 16:05:52 +0700
committerMax Nanis2025-06-09 16:05:52 +0700
commit74890e251dee3e0f195583431cb48b9f3a58ecc9 (patch)
treea27ceee03999f18fd3ef2e0d44ba7deb39f0b6c8 /src/Widget.tsx
parenta674d2e03de3bd048714d9c06e4bba9d9ecdb328 (diff)
downloadpanel-ui-74890e251dee3e0f195583431cb48b9f3a58ecc9.tar.gz
panel-ui-74890e251dee3e0f195583431cb48b9f3a58ecc9.zip
Cashout Methods page: adding walletSlice and cashoutmethodsSlice so they're in the stored state. Iterating with fix vs variable filters. Pulling old validators from old code and setting up the wallet fetch.
Diffstat (limited to 'src/Widget.tsx')
-rw-r--r--src/Widget.tsx22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/Widget.tsx b/src/Widget.tsx
index 3f7902c..f355194 100644
--- a/src/Widget.tsx
+++ b/src/Widget.tsx
@@ -6,9 +6,11 @@ import {Offerwall} from "@/pages/Offerwall.tsx"
import {QuestionsPage} from "@/pages/Questions.tsx";
import {useAppDispatch, useAppSelector} from "@/hooks.ts";
-import {OfferwallApi, ProfilingQuestionsApi} from "@/api";
+import {CashoutMethodOut, OfferwallApi, ProfilingQuestionsApi, UserWalletBalance, WalletApi} from "@/api";
import {ProfileQuestion, setQuestions} from "@/models/questionSlice.ts";
import {setBuckets} from "@/models/bucketSlice.ts";
+import {setCashoutMethods} from "@/models/cashoutMethodSlice.ts";
+import {setWallet} from "@/models/walletSlice.ts"
import {CashoutMethodsPage} from "@/pages/CashoutMethods.tsx";
import {setAvailabilityCount, setOfferwallId} from "@/models/appSlice.ts"
@@ -24,7 +26,6 @@ const Widget = () => {
// https://fsb.generalresearch.com/{product_id}/offerwall/37d1da64/?country
new OfferwallApi().offerwallSoftpairProductIdOfferwall37d1da64Get(app.bpid, app.bpuid, "104.9.125.144")
.then(res => {
-
// We want to set these questions first, because the Bucket Component views may do
// some redux lookups
const objects: ProfileQuestion[] = Object.values(res.data.offerwall.question_info) as ProfileQuestion[]
@@ -41,6 +42,21 @@ const Widget = () => {
dispatch(setQuestions(res.data.questions as ProfileQuestion[]))
})
.catch(err => console.log(err));
+
+ new WalletApi().getCashoutMethodsProductIdCashoutMethodsGet(app.bpid, app.bpuid)
+ .then(res => {
+ dispatch(setCashoutMethods(res.data.cashout_methods as CashoutMethodOut[]))
+ })
+ .catch(err => console.log(err))
+
+ new WalletApi().getUserWalletBalanceProductIdWalletGet(app.bpid, app.bpuid)
+ .then(res => {
+ dispatch(setWallet(res.data.wallet as UserWalletBalance))
+ })
+ .catch(err => {
+ // TODO: Wallet mode is likely off
+ })
+
}, []); // ← empty array means "run once"
@@ -56,7 +72,7 @@ const Widget = () => {
<div className="px-4 lg:px-6">
{app.currentPage === 'offerwall' && <Offerwall/>}
{app.currentPage === 'questions' && <QuestionsPage/>}
- {app.currentPage === 'cashouts' && <CashoutMethodsPage/>}
+ {app.currentPage === 'cashout_methods' && <CashoutMethodsPage/>}
</div>
</div>
</div>