@opexa/portal-components 0.0.84 → 0.0.85
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/hooks/useAccountQuery.js +2 -6
- package/dist/client/hooks/useAvailablePromosQuery.js +2 -6
- package/dist/client/hooks/useAvailableQuestsQuery.js +2 -6
- package/dist/client/hooks/useBetRecordsQuery.js +2 -6
- package/dist/client/hooks/useBonusQuery.js +2 -6
- package/dist/client/hooks/useBonusesQuery.js +2 -6
- package/dist/client/hooks/useCashbackBonusQuery.js +2 -6
- package/dist/client/hooks/useCashbackBonusesQuery.js +2 -6
- package/dist/client/hooks/useCashbacksQuery.js +1 -3
- package/dist/client/hooks/useCheckInDailyCheckInQuestMutation.js +2 -6
- package/dist/client/hooks/useClaimCashbackBonusMutation.js +2 -5
- package/dist/client/hooks/useClaimSpotBonusMutation.js +2 -5
- package/dist/client/hooks/useCreateGCashDepositMutation.js +3 -9
- package/dist/client/hooks/useCreateGCashWithdrawalMutation.js +2 -6
- package/dist/client/hooks/useCreateGameSessionMutation.js +4 -14
- package/dist/client/hooks/useCreateInstapayWithdrawalMutation.js +2 -6
- package/dist/client/hooks/useCreateMayaAppDepositMutation.js +3 -9
- package/dist/client/hooks/useCreateMayaAppWithdrawalMutation.js +2 -6
- package/dist/client/hooks/useCreateMayaDepositMutation.js +3 -9
- package/dist/client/hooks/useCreateMayaWithdrawalMutation.js +2 -6
- package/dist/client/hooks/useCreateOnlineBankDepositMutation.js +3 -9
- package/dist/client/hooks/useCreateQRPHDepositMutation.js +3 -9
- package/dist/client/hooks/useDepositQuery.js +2 -6
- package/dist/client/hooks/useDepositRecordsQuery.js +2 -6
- package/dist/client/hooks/useDepositsCountQuery.js +2 -6
- package/dist/client/hooks/useEndGameSessionMutation.js +2 -6
- package/dist/client/hooks/useFavoriteGamesQuery.js +2 -6
- package/dist/client/hooks/useInstapayBankListQuery.js +2 -6
- package/dist/client/hooks/useIsMayaSessionValidQuery.js +2 -6
- package/dist/client/hooks/useMarkGameAsFavoriteMutation.js +2 -5
- package/dist/client/hooks/useMarkMessageAsReadMutation.js +2 -5
- package/dist/client/hooks/useMemberVerificationQuery.js +2 -6
- package/dist/client/hooks/useMessagesQuery.js +2 -6
- package/dist/client/hooks/usePaymentSettingsQuery.js +2 -6
- package/dist/client/hooks/useProfileCompletionQuery.js +2 -6
- package/dist/client/hooks/useTransactionRecordsQuery.js +2 -6
- package/dist/client/hooks/useUnmarkGameAsFavoriteMutation.js +2 -5
- package/dist/client/hooks/useUnreadMessagesCountQuery.js +2 -6
- package/dist/client/hooks/useUpdateAccountMutation.js +2 -5
- package/dist/client/hooks/useWalletQuery.js +8 -7
- package/dist/client/hooks/useWithdrawalRecordsQuery.js +2 -6
- package/package.json +1 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getMemberAccount } from '../../services/index.js';
|
|
4
|
-
import { getAccountQueryKey
|
|
4
|
+
import { getAccountQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useAccountQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useAccountQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getAccountQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getMemberAccount({
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getAvailablePromos } from '../../services/index.js';
|
|
4
|
-
import { getAvailablePromosQueryKey
|
|
4
|
+
import { getAvailablePromosQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useAvailablePromosQuery = (input, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useAvailablePromosQuery = (input, config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getAvailablePromosQueryKey(input),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getAvailablePromos(input, {
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getAvailableQuests } from '../../services/index.js';
|
|
4
|
-
import { getAvailableQuestsQueryKey
|
|
4
|
+
import { getAvailableQuestsQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useAvailableQuestsQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useAvailableQuestsQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getAvailableQuestsQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getAvailableQuests({
|
|
23
19
|
signal,
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getBetRecords } from '../../services/index.js';
|
|
4
|
-
import { getBetRecordsQueryKey
|
|
4
|
+
import { getBetRecordsQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useBetRecordsQuery = (input, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useInfiniteQuery({
|
|
11
10
|
enabled: sessionQuery.data?.status === 'authenticated',
|
|
12
11
|
...config,
|
|
13
12
|
queryKey: getBetRecordsQueryKey(input),
|
|
14
13
|
queryFn: async ({ pageParam, signal }) => {
|
|
15
|
-
const session = await
|
|
16
|
-
queryKey: getSessionQueryKey(),
|
|
17
|
-
queryFn: () => getSession(),
|
|
18
|
-
});
|
|
14
|
+
const session = await getSession();
|
|
19
15
|
invariant(session.status === 'authenticated');
|
|
20
16
|
return await getBetRecords({ ...input, after: pageParam }, {
|
|
21
17
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getBonus } from '../../services/index.js';
|
|
4
|
-
import { getBonusQueryKey
|
|
4
|
+
import { getBonusQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useBonusQuery = (id, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useBonusQuery = (id, config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getBonusQueryKey(id),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
const bonus = await getBonus(id, {
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getBonuses } from '../../services/index.js';
|
|
4
|
-
import { getBonusesQueryKey
|
|
4
|
+
import { getBonusesQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useBonusesQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useBonusesQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getBonusesQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getBonuses({
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getCashbackBonus } from '../../services/index.js';
|
|
4
|
-
import { getCashbackBonusQueryKey
|
|
4
|
+
import { getCashbackBonusQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useCashbackBonusQuery = (id, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useCashbackBonusQuery = (id, config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getCashbackBonusQueryKey(id),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getCashbackBonus(id, {
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getCashbackBonuses } from '../../services/index.js';
|
|
4
|
-
import { getCashbackBonusesQueryKey
|
|
4
|
+
import { getCashbackBonusesQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useCashbackBonusesQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
return useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useCashbackBonusesQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getCashbackBonusesQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getCashbackBonuses({
|
|
23
19
|
signal,
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { checkInDailyCheckInQuest } from '../../services/index.js';
|
|
4
|
-
import { getCheckInDailyQuestMutationKey
|
|
4
|
+
import { getCheckInDailyQuestMutationKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
export const useCheckInDailyCheckInQuestMutation = (config) => {
|
|
7
|
-
const queryClient = getQueryClient();
|
|
8
7
|
const mutation = useMutation({
|
|
9
8
|
...config,
|
|
10
9
|
mutationKey: getCheckInDailyQuestMutationKey(),
|
|
11
10
|
mutationFn: async (id) => {
|
|
12
|
-
const session = await
|
|
13
|
-
queryKey: getSessionQueryKey(),
|
|
14
|
-
queryFn: () => getSession(),
|
|
15
|
-
});
|
|
11
|
+
const session = await getSession();
|
|
16
12
|
invariant(session.status === 'authenticated');
|
|
17
13
|
await checkInDailyCheckInQuest(id, {
|
|
18
14
|
headers: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { claimCashbackBonus } from '../../services/index.js';
|
|
4
|
-
import { getCashbackBonusesQueryKey, getClaimCashbackBonusMutationKey, getQueryClient,
|
|
4
|
+
import { getCashbackBonusesQueryKey, getClaimCashbackBonusMutationKey, getQueryClient, } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
export const useClaimCashbackBonusMutation = (config) => {
|
|
7
7
|
const queryClient = getQueryClient();
|
|
@@ -9,10 +9,7 @@ export const useClaimCashbackBonusMutation = (config) => {
|
|
|
9
9
|
...config,
|
|
10
10
|
mutationKey: getClaimCashbackBonusMutationKey(),
|
|
11
11
|
mutationFn: async (id) => {
|
|
12
|
-
const session = await
|
|
13
|
-
queryKey: getSessionQueryKey(),
|
|
14
|
-
queryFn: () => getSession(),
|
|
15
|
-
});
|
|
12
|
+
const session = await getSession();
|
|
16
13
|
invariant(session.status === 'authenticated');
|
|
17
14
|
await claimCashbackBonus(id, {
|
|
18
15
|
headers: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { claimSpotBonus } from '../../services/index.js';
|
|
4
|
-
import { getBonusesQueryKey, getClaimSpotBonusMutationKey, getQueryClient,
|
|
4
|
+
import { getBonusesQueryKey, getClaimSpotBonusMutationKey, getQueryClient, } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
export const useClaimSpotBonusMutation = (config) => {
|
|
7
7
|
const queryClient = getQueryClient();
|
|
@@ -9,10 +9,7 @@ export const useClaimSpotBonusMutation = (config) => {
|
|
|
9
9
|
...config,
|
|
10
10
|
mutationKey: getClaimSpotBonusMutationKey(),
|
|
11
11
|
mutationFn: async (id) => {
|
|
12
|
-
const session = await
|
|
13
|
-
queryKey: getSessionQueryKey(),
|
|
14
|
-
queryFn: () => getSession(),
|
|
15
|
-
});
|
|
12
|
+
const session = await getSession();
|
|
16
13
|
invariant(session.status === 'authenticated');
|
|
17
14
|
await claimSpotBonus(id, {
|
|
18
15
|
headers: {
|
|
@@ -2,7 +2,7 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createGCashDeposit, getDeposit, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { createPoll, getCreateGCashDepositMutationKey, getDepositsCountQueryKey, getQueryClient,
|
|
5
|
+
import { createPoll, getCreateGCashDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateGCashDepositMutation = (config) => {
|
|
8
8
|
const queryClient = getQueryClient();
|
|
@@ -11,10 +11,7 @@ export const useCreateGCashDepositMutation = (config) => {
|
|
|
11
11
|
mutationKey: getCreateGCashDepositMutationKey(),
|
|
12
12
|
mutationFn: async (input) => {
|
|
13
13
|
const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
14
|
+
const session = await getSession();
|
|
18
15
|
invariant(session.status === 'authenticated');
|
|
19
16
|
await createGCashDeposit({ ...input, id }, {
|
|
20
17
|
headers: {
|
|
@@ -22,10 +19,7 @@ export const useCreateGCashDepositMutation = (config) => {
|
|
|
22
19
|
},
|
|
23
20
|
});
|
|
24
21
|
const poll = createPoll(async () => {
|
|
25
|
-
const session = await
|
|
26
|
-
queryKey: getSessionQueryKey(),
|
|
27
|
-
queryFn: () => getSession(),
|
|
28
|
-
});
|
|
22
|
+
const session = await getSession();
|
|
29
23
|
invariant(session.status === 'authenticated');
|
|
30
24
|
return await getDeposit(id, {
|
|
31
25
|
headers: {
|
|
@@ -2,19 +2,15 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createGCashWithdrawal, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { getCreateGCashWithdrawalMutationKey
|
|
5
|
+
import { getCreateGCashWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateGCashWithdrawalMutation = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const mutation = useMutation({
|
|
10
9
|
...config,
|
|
11
10
|
mutationKey: getCreateGCashWithdrawalMutationKey(),
|
|
12
11
|
mutationFn: async (input) => {
|
|
13
12
|
const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
13
|
+
const session = await getSession();
|
|
18
14
|
invariant(session.status === 'authenticated');
|
|
19
15
|
await createGCashWithdrawal({ ...input, id }, {
|
|
20
16
|
headers: {
|
|
@@ -3,19 +3,15 @@ import invariant from 'tiny-invariant';
|
|
|
3
3
|
import { LEGACY_GAME_PROVIDERS } from '../../constants/index.js';
|
|
4
4
|
import { createGameSession, createGameSession__legacy, getGameSession, getGameSession__legacy, } from '../../services/index.js';
|
|
5
5
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
6
|
-
import { createPoll, getCreateGameSessionMutationKey
|
|
6
|
+
import { createPoll, getCreateGameSessionMutationKey } from '../../utils/index.js';
|
|
7
7
|
import { getSession } from '../services/index.js';
|
|
8
8
|
export const useCreateGameSessionMutation = (config) => {
|
|
9
|
-
const queryClient = getQueryClient();
|
|
10
9
|
return useMutation({
|
|
11
10
|
...config,
|
|
12
11
|
mutationKey: getCreateGameSessionMutationKey(),
|
|
13
12
|
mutationFn: async (game) => {
|
|
14
13
|
const id = ObjectId.generate(ObjectType.GameSession).toString();
|
|
15
|
-
const session = await
|
|
16
|
-
queryKey: getSessionQueryKey(),
|
|
17
|
-
queryFn: () => getSession(),
|
|
18
|
-
});
|
|
14
|
+
const session = await getSession();
|
|
19
15
|
invariant(session.status === 'authenticated');
|
|
20
16
|
if (LEGACY_GAME_PROVIDERS.includes(game.provider)) {
|
|
21
17
|
await createGameSession__legacy({
|
|
@@ -27,10 +23,7 @@ export const useCreateGameSessionMutation = (config) => {
|
|
|
27
23
|
},
|
|
28
24
|
});
|
|
29
25
|
const data = await createPoll(async () => {
|
|
30
|
-
const session = await
|
|
31
|
-
queryKey: getSessionQueryKey(),
|
|
32
|
-
queryFn: () => getSession(),
|
|
33
|
-
});
|
|
26
|
+
const session = await getSession();
|
|
34
27
|
invariant(session.status === 'authenticated');
|
|
35
28
|
return await getGameSession__legacy(id, {
|
|
36
29
|
headers: {
|
|
@@ -60,10 +53,7 @@ export const useCreateGameSessionMutation = (config) => {
|
|
|
60
53
|
},
|
|
61
54
|
});
|
|
62
55
|
const data = await createPoll(async () => {
|
|
63
|
-
const session = await
|
|
64
|
-
queryKey: getSessionQueryKey(),
|
|
65
|
-
queryFn: () => getSession(),
|
|
66
|
-
});
|
|
56
|
+
const session = await getSession();
|
|
67
57
|
invariant(session.status === 'authenticated');
|
|
68
58
|
return await getGameSession(id, {
|
|
69
59
|
headers: {
|
|
@@ -2,19 +2,15 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createAIOInstapayWithdrawal, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { getCreateInstapayWithdrawalMutationKey
|
|
5
|
+
import { getCreateInstapayWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateInstapayWithdrawalMutation = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const mutation = useMutation({
|
|
10
9
|
...config,
|
|
11
10
|
mutationKey: getCreateInstapayWithdrawalMutationKey(),
|
|
12
11
|
mutationFn: async (input) => {
|
|
13
12
|
const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
13
|
+
const session = await getSession();
|
|
18
14
|
invariant(session.status === 'authenticated');
|
|
19
15
|
await createAIOInstapayWithdrawal({ ...input, id }, {
|
|
20
16
|
headers: {
|
|
@@ -2,7 +2,7 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createMayaAppDeposit, getDeposit, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { createPoll, getCreateMayaAppDepositMutationKey, getDepositsCountQueryKey, getQueryClient,
|
|
5
|
+
import { createPoll, getCreateMayaAppDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateMayaAppDepositMutation = (config) => {
|
|
8
8
|
const queryClient = getQueryClient();
|
|
@@ -11,10 +11,7 @@ export const useCreateMayaAppDepositMutation = (config) => {
|
|
|
11
11
|
mutationKey: getCreateMayaAppDepositMutationKey(),
|
|
12
12
|
mutationFn: async (input) => {
|
|
13
13
|
const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
14
|
+
const session = await getSession();
|
|
18
15
|
invariant(session.status === 'authenticated');
|
|
19
16
|
await createMayaAppDeposit({ ...input, id }, {
|
|
20
17
|
headers: {
|
|
@@ -22,10 +19,7 @@ export const useCreateMayaAppDepositMutation = (config) => {
|
|
|
22
19
|
},
|
|
23
20
|
});
|
|
24
21
|
const poll = createPoll(async () => {
|
|
25
|
-
const session = await
|
|
26
|
-
queryKey: getSessionQueryKey(),
|
|
27
|
-
queryFn: () => getSession(),
|
|
28
|
-
});
|
|
22
|
+
const session = await getSession();
|
|
29
23
|
invariant(session.status === 'authenticated');
|
|
30
24
|
return await getDeposit(id, {
|
|
31
25
|
headers: {
|
|
@@ -2,19 +2,15 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createMayaAppWithdrawal, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { getCreateMayaAppWithdrawalMutationKey
|
|
5
|
+
import { getCreateMayaAppWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateMayaAppWithdrawalMutation = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const mutation = useMutation({
|
|
10
9
|
...config,
|
|
11
10
|
mutationKey: getCreateMayaAppWithdrawalMutationKey(),
|
|
12
11
|
mutationFn: async (input) => {
|
|
13
12
|
const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
13
|
+
const session = await getSession();
|
|
18
14
|
invariant(session.status === 'authenticated');
|
|
19
15
|
await createMayaAppWithdrawal({ ...input, id }, {
|
|
20
16
|
headers: {
|
|
@@ -2,7 +2,7 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createMayaDeposit, getDeposit, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { createPoll, getCreateMayaDepositMutationKey, getDepositsCountQueryKey, getQueryClient,
|
|
5
|
+
import { createPoll, getCreateMayaDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateMayaDepositMutation = (config) => {
|
|
8
8
|
const queryClient = getQueryClient();
|
|
@@ -11,10 +11,7 @@ export const useCreateMayaDepositMutation = (config) => {
|
|
|
11
11
|
mutationKey: getCreateMayaDepositMutationKey(),
|
|
12
12
|
mutationFn: async (input) => {
|
|
13
13
|
const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
14
|
+
const session = await getSession();
|
|
18
15
|
invariant(session.status === 'authenticated');
|
|
19
16
|
await createMayaDeposit({ ...input, id }, {
|
|
20
17
|
headers: {
|
|
@@ -22,10 +19,7 @@ export const useCreateMayaDepositMutation = (config) => {
|
|
|
22
19
|
},
|
|
23
20
|
});
|
|
24
21
|
const poll = createPoll(async () => {
|
|
25
|
-
const session = await
|
|
26
|
-
queryKey: getSessionQueryKey(),
|
|
27
|
-
queryFn: () => getSession(),
|
|
28
|
-
});
|
|
22
|
+
const session = await getSession();
|
|
29
23
|
invariant(session.status === 'authenticated');
|
|
30
24
|
return await getDeposit(id, {
|
|
31
25
|
headers: {
|
|
@@ -2,19 +2,15 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createMayaWithdrawal, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { getCreateMayaWithdrawalMutationKey
|
|
5
|
+
import { getCreateMayaWithdrawalMutationKey } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateMayaWithdrawalMutation = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const mutation = useMutation({
|
|
10
9
|
...config,
|
|
11
10
|
mutationKey: getCreateMayaWithdrawalMutationKey(),
|
|
12
11
|
mutationFn: async (input) => {
|
|
13
12
|
const id = input.id ?? ObjectId.generate(ObjectType.Withdrawal).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
13
|
+
const session = await getSession();
|
|
18
14
|
invariant(session.status === 'authenticated');
|
|
19
15
|
await createMayaWithdrawal({ ...input, id }, {
|
|
20
16
|
headers: {
|
|
@@ -2,7 +2,7 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createAIOOnlineBankDeposit, getDeposit, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { createPoll, getCreateOnlineBankDepositMutationKey, getDepositsCountQueryKey, getQueryClient,
|
|
5
|
+
import { createPoll, getCreateOnlineBankDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateOnlineBankDepositMutation = (config) => {
|
|
8
8
|
const queryClient = getQueryClient();
|
|
@@ -11,10 +11,7 @@ export const useCreateOnlineBankDepositMutation = (config) => {
|
|
|
11
11
|
mutationKey: getCreateOnlineBankDepositMutationKey(),
|
|
12
12
|
mutationFn: async (input) => {
|
|
13
13
|
const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
14
|
+
const session = await getSession();
|
|
18
15
|
invariant(session.status === 'authenticated');
|
|
19
16
|
await createAIOOnlineBankDeposit({ ...input, id }, {
|
|
20
17
|
headers: {
|
|
@@ -22,10 +19,7 @@ export const useCreateOnlineBankDepositMutation = (config) => {
|
|
|
22
19
|
},
|
|
23
20
|
});
|
|
24
21
|
const poll = createPoll(async () => {
|
|
25
|
-
const session = await
|
|
26
|
-
queryKey: getSessionQueryKey(),
|
|
27
|
-
queryFn: () => getSession(),
|
|
28
|
-
});
|
|
22
|
+
const session = await getSession();
|
|
29
23
|
invariant(session.status === 'authenticated');
|
|
30
24
|
return await getDeposit(id, {
|
|
31
25
|
headers: {
|
|
@@ -2,7 +2,7 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { createAIOQRPHDeposit, getDeposit, } from '../../services/index.js';
|
|
4
4
|
import { ObjectId, ObjectType } from '../../services/ObjectId.js';
|
|
5
|
-
import { createPoll, getCreateQRPHDepositMutationKey, getDepositsCountQueryKey, getQueryClient,
|
|
5
|
+
import { createPoll, getCreateQRPHDepositMutationKey, getDepositsCountQueryKey, getQueryClient, } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useCreateQRPHDepositMutation = (config) => {
|
|
8
8
|
const queryClient = getQueryClient();
|
|
@@ -11,10 +11,7 @@ export const useCreateQRPHDepositMutation = (config) => {
|
|
|
11
11
|
mutationKey: getCreateQRPHDepositMutationKey(),
|
|
12
12
|
mutationFn: async (input) => {
|
|
13
13
|
const id = input.id ?? ObjectId.generate(ObjectType.Deposit).toString();
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
14
|
+
const session = await getSession();
|
|
18
15
|
invariant(session.status === 'authenticated');
|
|
19
16
|
await createAIOQRPHDeposit({ ...input, id }, {
|
|
20
17
|
headers: {
|
|
@@ -22,10 +19,7 @@ export const useCreateQRPHDepositMutation = (config) => {
|
|
|
22
19
|
},
|
|
23
20
|
});
|
|
24
21
|
const poll = createPoll(async () => {
|
|
25
|
-
const session = await
|
|
26
|
-
queryKey: getSessionQueryKey(),
|
|
27
|
-
queryFn: () => getSession(),
|
|
28
|
-
});
|
|
22
|
+
const session = await getSession();
|
|
29
23
|
invariant(session.status === 'authenticated');
|
|
30
24
|
return await getDeposit(id, {
|
|
31
25
|
headers: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getDeposit } from '../../services/index.js';
|
|
4
|
-
import { getDepositQueryKey
|
|
4
|
+
import { getDepositQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useDepositQuery = (id, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -16,10 +15,7 @@ export const useDepositQuery = (id, config) => {
|
|
|
16
15
|
: sessionQuery.data?.status === 'authenticated',
|
|
17
16
|
queryKey: getDepositQueryKey(id),
|
|
18
17
|
queryFn: async ({ signal }) => {
|
|
19
|
-
const session = await
|
|
20
|
-
queryKey: getSessionQueryKey(),
|
|
21
|
-
queryFn: () => getSession(),
|
|
22
|
-
});
|
|
18
|
+
const session = await getSession({ signal });
|
|
23
19
|
invariant(session.status === 'authenticated');
|
|
24
20
|
const deposit = await getDeposit(id, {
|
|
25
21
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getDepositRecords } from '../../services/index.js';
|
|
4
|
-
import { getDepositRecordsQueryKey
|
|
4
|
+
import { getDepositRecordsQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useDepositRecordsQuery = (input, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useInfiniteQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useDepositRecordsQuery = (input, config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getDepositRecordsQueryKey(input),
|
|
16
15
|
queryFn: async ({ pageParam, signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getDepositRecords({ ...input, after: pageParam }, {
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getDepositsCount } from '../../services/index.js';
|
|
4
|
-
import { getDepositsCountQueryKey
|
|
4
|
+
import { getDepositsCountQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useDepositsCountQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useDepositsCountQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getDepositsCountQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
const depositsCount = await getDepositsCount({
|
|
23
19
|
signal,
|
|
@@ -2,18 +2,14 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { LEGACY_GAME_PROVIDERS } from '../../constants/index.js';
|
|
4
4
|
import { endGameSession, endGameSession__legacy } from '../../services/index.js';
|
|
5
|
-
import { getEndGameSessionMutationKey
|
|
5
|
+
import { getEndGameSessionMutationKey } from '../../utils/index.js';
|
|
6
6
|
import { getSession } from '../services/index.js';
|
|
7
7
|
export const useEndGameSessionMutation = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
return useMutation({
|
|
10
9
|
...config,
|
|
11
10
|
mutationKey: getEndGameSessionMutationKey(),
|
|
12
11
|
mutationFn: async (input) => {
|
|
13
|
-
const session = await
|
|
14
|
-
queryKey: getSessionQueryKey(),
|
|
15
|
-
queryFn: () => getSession(),
|
|
16
|
-
});
|
|
12
|
+
const session = await getSession();
|
|
17
13
|
invariant(session.status === 'authenticated');
|
|
18
14
|
if (LEGACY_GAME_PROVIDERS.includes(input.game.provider)) {
|
|
19
15
|
await endGameSession__legacy(input.session.id, {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getFavoriteGames } from '../../services/index.js';
|
|
4
|
-
import { getFavoriteGamesQueryKey
|
|
4
|
+
import { getFavoriteGamesQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useFavoriteGamesQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
return useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useFavoriteGamesQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getFavoriteGamesQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
const favoriteGames = getFavoriteGames({
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getInstapayBankList } from '../../services/index.js';
|
|
4
|
-
import { getInstapayBankListQueryKey
|
|
4
|
+
import { getInstapayBankListQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useInstapayBankListQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useInstapayBankListQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getInstapayBankListQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
const instapayBankList = await getInstapayBankList({
|
|
23
19
|
signal,
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { validateMayaSession } from '../../services/index.js';
|
|
4
|
-
import { getIsMayaSessionValidQueryKey
|
|
4
|
+
import { getIsMayaSessionValidQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useOnMMA } from './useOnMMA.js';
|
|
7
7
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
8
8
|
export const useIsMayaSessionValidQuery = (config) => {
|
|
9
9
|
const [onMMA] = useOnMMA();
|
|
10
|
-
const queryClient = getQueryClient();
|
|
11
10
|
const sessionQuery = useSessionQuery();
|
|
12
11
|
const query = useQuery({
|
|
13
12
|
gcTime: 0,
|
|
@@ -23,10 +22,7 @@ export const useIsMayaSessionValidQuery = (config) => {
|
|
|
23
22
|
: sessionQuery.data?.status === 'authenticated',
|
|
24
23
|
queryKey: getIsMayaSessionValidQueryKey(),
|
|
25
24
|
queryFn: async ({ signal }) => {
|
|
26
|
-
const session = await
|
|
27
|
-
queryKey: getSessionQueryKey(),
|
|
28
|
-
queryFn: () => getSession(),
|
|
29
|
-
});
|
|
25
|
+
const session = await getSession({ signal });
|
|
30
26
|
invariant(session.status === 'authenticated');
|
|
31
27
|
try {
|
|
32
28
|
await validateMayaSession({
|
|
@@ -2,17 +2,14 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getSession } from '../../client/services/index.js';
|
|
4
4
|
import { markGameAsFavorite } from '../../services/index.js';
|
|
5
|
-
import { getFavoriteGamesQueryKey, getGamesQueryKey, getMarkGameAsFavoriteMutationKey, getQueryClient,
|
|
5
|
+
import { getFavoriteGamesQueryKey, getGamesQueryKey, getMarkGameAsFavoriteMutationKey, getQueryClient, } from '../../utils/index.js';
|
|
6
6
|
export const useMarkGameAsFavoriteMutation = (config) => {
|
|
7
7
|
const queryClient = getQueryClient();
|
|
8
8
|
const mutation = useMutation({
|
|
9
9
|
...config,
|
|
10
10
|
mutationKey: getMarkGameAsFavoriteMutationKey(),
|
|
11
11
|
mutationFn: async (id) => {
|
|
12
|
-
const session = await
|
|
13
|
-
queryKey: getSessionQueryKey(),
|
|
14
|
-
queryFn: () => getSession(),
|
|
15
|
-
});
|
|
12
|
+
const session = await getSession();
|
|
16
13
|
invariant(session.status === 'authenticated');
|
|
17
14
|
await markGameAsFavorite(id, {
|
|
18
15
|
headers: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { markMessageAsRead } from '../../services/index.js';
|
|
4
|
-
import { getMarkMessageAsReadMutationKey, getMessagesQueryKey, getQueryClient,
|
|
4
|
+
import { getMarkMessageAsReadMutationKey, getMessagesQueryKey, getQueryClient, getUnreadMessagesCountQueryKey, } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
export const useMarkMessageAsReadMutation = (config) => {
|
|
7
7
|
const queryClient = getQueryClient();
|
|
@@ -9,10 +9,7 @@ export const useMarkMessageAsReadMutation = (config) => {
|
|
|
9
9
|
...config,
|
|
10
10
|
mutationKey: getMarkMessageAsReadMutationKey(),
|
|
11
11
|
mutationFn: async (id) => {
|
|
12
|
-
const session = await
|
|
13
|
-
queryKey: getSessionQueryKey(),
|
|
14
|
-
queryFn: () => getSession(),
|
|
15
|
-
});
|
|
12
|
+
const session = await getSession();
|
|
16
13
|
invariant(session.status === 'authenticated');
|
|
17
14
|
await markMessageAsRead(id, {
|
|
18
15
|
headers: {
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getMemberVerification } from '../../services/index.js';
|
|
4
|
-
import { getMemberVerificationQueryKey
|
|
4
|
+
import { getMemberVerificationQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useMemberVerificationQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
enabled: sessionQuery.data?.status === 'authenticated',
|
|
12
11
|
...config,
|
|
13
12
|
queryKey: getMemberVerificationQueryKey(),
|
|
14
13
|
queryFn: async ({ signal }) => {
|
|
15
|
-
const session = await
|
|
16
|
-
queryKey: getSessionQueryKey(),
|
|
17
|
-
queryFn: () => getSession(),
|
|
18
|
-
});
|
|
14
|
+
const session = await getSession({ signal });
|
|
19
15
|
invariant(session.status === 'authenticated');
|
|
20
16
|
return await getMemberVerification({
|
|
21
17
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getMessages } from '../../services/index.js';
|
|
4
|
-
import { getMessagesQueryKey
|
|
4
|
+
import { getMessagesQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useMessagesQuery = (input, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useInfiniteQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useMessagesQuery = (input, config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getMessagesQueryKey(input),
|
|
16
15
|
queryFn: async ({ pageParam, signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return getMessages({ ...input, after: pageParam }, {
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getPaymentSettings } from '../../services/index.js';
|
|
4
|
-
import { getPaymentSettingsQueryKey
|
|
4
|
+
import { getPaymentSettingsQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const usePaymentSettingsQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const usePaymentSettingsQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getPaymentSettingsQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getPaymentSettings({
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getProfileCompletion } from '../../services/index.js';
|
|
4
|
-
import { getProfileCompletionQueryKey
|
|
4
|
+
import { getProfileCompletionQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useProfileCompletionQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useProfileCompletionQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getProfileCompletionQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getProfileCompletion({
|
|
23
19
|
signal,
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getTransactionRecords, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getTransactionRecordsQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useTransactionRecordsQuery = (input, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useInfiniteQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useTransactionRecordsQuery = (input, config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getTransactionRecordsQueryKey(input),
|
|
16
15
|
queryFn: async ({ pageParam, signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return getTransactionRecords({ ...input, after: pageParam }, {
|
|
23
19
|
signal,
|
|
@@ -2,17 +2,14 @@ import { useMutation } from '@tanstack/react-query';
|
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getSession } from '../../client/services/index.js';
|
|
4
4
|
import { unmarkGameAsFavorite } from '../../services/index.js';
|
|
5
|
-
import { getFavoriteGamesQueryKey, getGamesQueryKey, getQueryClient,
|
|
5
|
+
import { getFavoriteGamesQueryKey, getGamesQueryKey, getQueryClient, getUnmarkGameAsFavoriteMutationKey, } from '../../utils/index.js';
|
|
6
6
|
export const useUnmarkGameAsFavoriteMutation = (config) => {
|
|
7
7
|
const queryClient = getQueryClient();
|
|
8
8
|
const mutation = useMutation({
|
|
9
9
|
...config,
|
|
10
10
|
mutationKey: getUnmarkGameAsFavoriteMutationKey(),
|
|
11
11
|
mutationFn: async (id) => {
|
|
12
|
-
const session = await
|
|
13
|
-
queryKey: getSessionQueryKey(),
|
|
14
|
-
queryFn: () => getSession(),
|
|
15
|
-
});
|
|
12
|
+
const session = await getSession();
|
|
16
13
|
invariant(session.status === 'authenticated');
|
|
17
14
|
await unmarkGameAsFavorite(id, {
|
|
18
15
|
headers: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getUnreadMessagesCount, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getUnreadMessagesCountQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useUnreadMessagesCountQuery = (input, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useUnreadMessagesCountQuery = (input, config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getUnreadMessagesCountQueryKey(input),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getUnreadMessagesCount(input, {
|
|
23
19
|
signal,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useMutation } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { updateMemberAccount, } from '../../services/index.js';
|
|
4
|
-
import { getAccountQueryKey, getProfileCompletionQueryKey, getQueryClient,
|
|
4
|
+
import { getAccountQueryKey, getProfileCompletionQueryKey, getQueryClient, getUpdateAccountMutationKey, } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useAccountQuery } from './useAccountQuery.js';
|
|
7
7
|
export const useUpdateAccountMutation = (config) => {
|
|
@@ -11,10 +11,7 @@ export const useUpdateAccountMutation = (config) => {
|
|
|
11
11
|
...config,
|
|
12
12
|
mutationKey: getUpdateAccountMutationKey(),
|
|
13
13
|
mutationFn: async (input) => {
|
|
14
|
-
const session = await
|
|
15
|
-
queryKey: getSessionQueryKey(),
|
|
16
|
-
queryFn: () => getSession(),
|
|
17
|
-
});
|
|
14
|
+
const session = await getSession();
|
|
18
15
|
invariant(session.status === 'authenticated');
|
|
19
16
|
invariant(accountQuery.data);
|
|
20
17
|
await updateMemberAccount(accountQuery.data.id, input, {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getWallet } from '../../services/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getWalletQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useWalletQuery = (config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
return useQuery({
|
|
11
10
|
...config,
|
|
@@ -14,12 +13,14 @@ export const useWalletQuery = (config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getWalletQueryKey(),
|
|
16
15
|
queryFn: async ({ signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession({ signal });
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
|
-
const wallet = await getWallet({
|
|
18
|
+
const wallet = await getWallet({
|
|
19
|
+
signal,
|
|
20
|
+
headers: {
|
|
21
|
+
Authorization: `Bearer ${session.token}`,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
23
24
|
return wallet ?? null;
|
|
24
25
|
},
|
|
25
26
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useInfiniteQuery } from '@tanstack/react-query';
|
|
2
2
|
import invariant from 'tiny-invariant';
|
|
3
3
|
import { getWithdrawalRecords, } from '../../services/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { getWithdrawalRecordsQueryKey } from '../../utils/index.js';
|
|
5
5
|
import { getSession } from '../services/index.js';
|
|
6
6
|
import { useSessionQuery } from './useSessionQuery.js';
|
|
7
7
|
export const useWithdrawalRecordsQuery = (input, config) => {
|
|
8
|
-
const queryClient = getQueryClient();
|
|
9
8
|
const sessionQuery = useSessionQuery();
|
|
10
9
|
const query = useInfiniteQuery({
|
|
11
10
|
...config,
|
|
@@ -14,10 +13,7 @@ export const useWithdrawalRecordsQuery = (input, config) => {
|
|
|
14
13
|
: sessionQuery.data?.status === 'authenticated',
|
|
15
14
|
queryKey: getWithdrawalRecordsQueryKey(input),
|
|
16
15
|
queryFn: async ({ pageParam, signal }) => {
|
|
17
|
-
const session = await
|
|
18
|
-
queryKey: getSessionQueryKey(),
|
|
19
|
-
queryFn: () => getSession(),
|
|
20
|
-
});
|
|
16
|
+
const session = await getSession();
|
|
21
17
|
invariant(session.status === 'authenticated');
|
|
22
18
|
return await getWithdrawalRecords({ ...input, after: pageParam }, {
|
|
23
19
|
signal,
|