🐛 fix(api): Subscribe token

This commit is contained in:
web@ppanel 2024-12-14 00:33:04 +07:00
parent 19837a1032
commit 1932ba766c
8 changed files with 22 additions and 22 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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>
@ -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'>

View File

@ -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);
@ -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();
@ -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}>

View File

@ -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');
@ -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();
@ -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;

View File

@ -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}`;
}
});
},

View File

@ -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;

View File

@ -347,7 +347,7 @@ declare namespace API {
quantity: number;
payment: string;
coupon?: string;
subscribe_mark: string;
subscribe_token: string;
};
type RenewalOrderResponse = {
@ -356,7 +356,7 @@ declare namespace API {
type ResetTrafficOrderRequest = {
subscribe_id: number;
subscribe_mark: string;
subscribe_token: string;
payment: string;
};
@ -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;