blob: c28b55db30a694b5600cfdda1232e9200bc129ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
import React, {useEffect} from 'react'
import {AppSidebar} from "@/components/app-sidebar"
import {SiteHeader} from "@/components/site-header"
import {SidebarInset, SidebarProvider} from "@/components/ui/sidebar"
import {Offerwall} from "@/pages/Offerwall.tsx"
import {QuestionsPage} from "@/pages/Questions.tsx";
import {useAppDispatch, useAppSelector} from "@/hooks.ts";
import {OfferwallApi, ProfilingQuestionsApi} from "@/api";
import {setBuckets} from "@/models/bucketSlice.ts";
import {setQuestions} from "@/models/questionSlice.ts"
import {CashoutMethodsPage} from "@/pages/CashoutMethods.tsx";
import './index.css';
const Widget = () => {
const dispatch = useAppDispatch()
const app = useAppSelector(state => state.app)
useEffect(() => {
// https://fsb.generalresearch.com/{product_id}/offerwall/37d1da64/?country
new OfferwallApi().offerwallSoftpairProductIdOfferwall37d1da64Get(app.bpid, app.bpuid, "104.9.125.144")
.then(res => {
dispatch(setBuckets(res.data.offerwall.buckets))
})
.catch(err => console.log(err));
new ProfilingQuestionsApi().getProfilingQuestionsProductIdProfilingQuestionsGet(app.bpid, app.bpuid, "104.9.125.144", undefined, undefined, 2500 )
.then(res => {
dispatch(setQuestions(res.data.questions))
})
.catch(err => console.log(err));
}, []); // ← empty array means "run once"
return (
<SidebarProvider>
<AppSidebar variant="floating" />
<SidebarInset>
<SiteHeader/>
<div className="flex flex-1 flex-col">
<div className="@container/main flex flex-1 flex-col gap-2">
<div className="flex flex-col gap-4 py-4 md:gap-6 md:py-6">
<div className="px-4 lg:px-6">
{app.currentPage === 'offerwall' && <Offerwall />}
{app.currentPage === 'questions' && <QuestionsPage />}
{app.currentPage === 'cashouts' && <CashoutMethodsPage />}
</div>
</div>
</div>
</div>
</SidebarInset>
</SidebarProvider>
)
}
export {Widget}
|