Skip to content

Commit

Permalink
🐛 fix(api): Subscribe token
Browse files Browse the repository at this point in the history
  • Loading branch information
web-ppanel committed Dec 13, 2024
1 parent 19837a1 commit 1932ba7
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion apps/admin/services/admin/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ declare namespace API {
traffic: number;
download: number;
upload: number;
mark: string;
token: string;
status: number;
created_at: number;
updated_at: number;
Expand Down
2 changes: 1 addition & 1 deletion apps/admin/services/common/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ declare namespace API {
traffic: number;
download: number;
upload: number;
mark: string;
token: string;
status: number;
created_at: number;
updated_at: number;
Expand Down
6 changes: 3 additions & 3 deletions apps/user/app/(main)/(user)/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ export default function Page() {
</AlertDialog>
<ResetTraffic
id={item.subscribe_id}
mark={item.mark}
token={item.token}
replacement={item.subscribe.replacement}
/>
<Renewal mark={item.mark} subscribe={item.subscribe} />
<Renewal token={item.token} subscribe={item.subscribe} />
</div>
</CardHeader>
<CardContent>
Expand Down Expand Up @@ -184,7 +184,7 @@ export default function Page() {
</ul>
<Separator className='mt-4' />
<Accordion type='single' collapsible defaultValue='0' className='w-full'>
{getUserSubscribe(item.mark, protocol)?.map((url, index) => (
{getUserSubscribe(item.token, protocol)?.map((url, index) => (
<AccordionItem key={url} value={String(index)}>
<AccordionTrigger className='hover:no-underline'>
<div className='flex w-full flex-row items-center justify-between'>
Expand Down
10 changes: 5 additions & 5 deletions apps/user/app/(main)/(user)/order/renewal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { useEffect, useState, useTransition } from 'react';
import { SubscribeBilling } from '../subscribe/billing';
import { SubscribeDetail } from '../subscribe/detail';

export default function Renewal({ mark, subscribe }: { mark: string; subscribe: API.Subscribe }) {
export default function Renewal({ token, subscribe }: { token: string; subscribe: API.Subscribe }) {
const t = useTranslations('order');
const { getUserInfo } = useGlobalStore();
const [open, setOpen] = useState<boolean>(false);
Expand All @@ -31,7 +31,7 @@ export default function Renewal({ mark, subscribe }: { mark: string; subscribe:
subscribe_id: subscribe.id,
payment: 'balance',
coupon: '',
subscribe_mark: mark,
subscribe_token: token,
});
const [loading, startTransition] = useTransition();

Expand All @@ -56,15 +56,15 @@ export default function Renewal({ mark, subscribe }: { mark: string; subscribe:
});

useEffect(() => {
if (subscribe.id && mark) {
if (subscribe.id && token) {
setParams((prev) => ({
...prev,
quantity: 1,
subscribe_id: subscribe.id,
subscribe_mark: mark,
subscribe_token: token,
}));
}
}, [subscribe.id, mark]);
}, [subscribe.id, token]);

return (
<Dialog open={open} onOpenChange={setOpen}>
Expand Down
12 changes: 6 additions & 6 deletions apps/user/app/(main)/(user)/order/reset-traffic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ import { useEffect, useState, useTransition } from 'react';

export default function ResetTraffic({
id,
mark,
token,
replacement,
}: {
id: number;
mark: string;
token: string;
replacement?: number;
}) {
const t = useTranslations('order');
Expand All @@ -38,7 +38,7 @@ export default function ResetTraffic({
const [params, setParams] = useState<API.ResetTrafficOrderRequest>({
subscribe_id: id,
payment: 'balance',
subscribe_mark: mark,
subscribe_token: token,
});
const [loading, startTransition] = useTransition();

Expand All @@ -51,15 +51,15 @@ export default function ResetTraffic({
});

useEffect(() => {
if (id && mark) {
if (id && token) {
setParams((prev) => ({
...prev,
quantity: 1,
subscribe_id: id,
subscribe_mark: mark,
subscribe_token: token,
}));
}
}, [id, mark]);
}, [id, token]);

if (!replacement) return;

Expand Down
4 changes: 2 additions & 2 deletions apps/user/config/use-global.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export const useGlobalStore = create<GlobalStore>((set, get) => ({
if (type) return `https://${uuid}.${type}.${domain}`;
return `https://${uuid}.${domain}`;
} else {
if (type) return `https://${domain}${subscribe_path}?mark=${uuid}&type=${type}`;
return `https://${domain}${subscribe_path}?mark=${uuid}`;
if (type) return `https://${domain}${subscribe_path}?token=${uuid}&type=${type}`;
return `https://${domain}${subscribe_path}?token=${uuid}`;
}
});
},
Expand Down
2 changes: 1 addition & 1 deletion apps/user/services/common/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ declare namespace API {
traffic: number;
download: number;
upload: number;
mark: string;
token: string;
status: number;
created_at: number;
updated_at: number;
Expand Down
6 changes: 3 additions & 3 deletions apps/user/services/user/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ declare namespace API {
quantity: number;
payment: string;
coupon?: string;
subscribe_mark: string;
subscribe_token: string;
};

type RenewalOrderResponse = {
Expand All @@ -356,7 +356,7 @@ declare namespace API {

type ResetTrafficOrderRequest = {
subscribe_id: number;
subscribe_mark: string;
subscribe_token: string;
payment: string;
};

Expand Down Expand Up @@ -592,7 +592,7 @@ declare namespace API {
traffic: number;
download: number;
upload: number;
mark: string;
token: string;
status: number;
created_at: number;
updated_at: number;
Expand Down

0 comments on commit 1932ba7

Please sign in to comment.