🐛 fix(subscription): Add reset functionality for user subscription token
This commit is contained in:
parent
52c1d1fc60
commit
39e89bfef5
@ -7,7 +7,7 @@ import Unsubscribe from '@/components/subscribe/unsubscribe';
|
|||||||
import useGlobalStore from '@/config/use-global';
|
import useGlobalStore from '@/config/use-global';
|
||||||
import { getStat } from '@/services/common/common';
|
import { getStat } from '@/services/common/common';
|
||||||
import { queryApplicationConfig } from '@/services/user/subscribe';
|
import { queryApplicationConfig } from '@/services/user/subscribe';
|
||||||
import { queryUserSubscribe } from '@/services/user/user';
|
import { queryUserSubscribe, resetUserSubscribeToken } from '@/services/user/user';
|
||||||
import { getPlatform } from '@/utils/common';
|
import { getPlatform } from '@/utils/common';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import {
|
import {
|
||||||
@ -58,7 +58,7 @@ export default function Content() {
|
|||||||
|
|
||||||
const [protocol, setProtocol] = useState('');
|
const [protocol, setProtocol] = useState('');
|
||||||
|
|
||||||
const { data: userSubscribe = [] } = useQuery({
|
const { data: userSubscribe = [], refetch } = useQuery({
|
||||||
queryKey: ['queryUserSubscribe'],
|
queryKey: ['queryUserSubscribe'],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const { data } = await queryUserSubscribe();
|
const { data } = await queryUserSubscribe();
|
||||||
@ -159,7 +159,15 @@ export default function Content() {
|
|||||||
</AlertDialogHeader>
|
</AlertDialogHeader>
|
||||||
<AlertDialogFooter>
|
<AlertDialogFooter>
|
||||||
<AlertDialogCancel>{t('cancel')}</AlertDialogCancel>
|
<AlertDialogCancel>{t('cancel')}</AlertDialogCancel>
|
||||||
<AlertDialogAction onClick={() => toast.success(t('resetSuccess'))}>
|
<AlertDialogAction
|
||||||
|
onClick={async () => {
|
||||||
|
await resetUserSubscribeToken({
|
||||||
|
user_subscribe_id: item.id,
|
||||||
|
});
|
||||||
|
await refetch();
|
||||||
|
toast.success(t('resetSuccess'));
|
||||||
|
}}
|
||||||
|
>
|
||||||
{t('confirm')}
|
{t('confirm')}
|
||||||
</AlertDialogAction>
|
</AlertDialogAction>
|
||||||
</AlertDialogFooter>
|
</AlertDialogFooter>
|
||||||
|
|||||||
@ -31,7 +31,7 @@ export function UserNav() {
|
|||||||
<Avatar className='size-8'>
|
<Avatar className='size-8'>
|
||||||
<AvatarImage alt={user?.avatar ?? ''} src={user?.avatar ?? ''} />
|
<AvatarImage alt={user?.avatar ?? ''} src={user?.avatar ?? ''} />
|
||||||
<AvatarFallback className='rounded-none bg-transparent'>
|
<AvatarFallback className='rounded-none bg-transparent'>
|
||||||
{user?.email?.[0]?.toUpperCase() || user?.telephone?.[0]?.toUpperCase()}
|
{user?.auth_methods?.[0]?.auth_identifier.toUpperCase().charAt(0)}
|
||||||
</AvatarFallback>
|
</AvatarFallback>
|
||||||
</Avatar>
|
</Avatar>
|
||||||
</Button>
|
</Button>
|
||||||
@ -40,7 +40,9 @@ export function UserNav() {
|
|||||||
<DropdownMenuLabel className='font-normal'>
|
<DropdownMenuLabel className='font-normal'>
|
||||||
<div className='flex flex-col space-y-1'>
|
<div className='flex flex-col space-y-1'>
|
||||||
<p className='text-muted-foreground text-xs leading-none'>ID: {user?.id}</p>
|
<p className='text-muted-foreground text-xs leading-none'>ID: {user?.id}</p>
|
||||||
<p className='text-sm font-medium leading-none'>{user?.telephone || user?.email}</p>
|
<p className='text-sm font-medium leading-none'>
|
||||||
|
{user?.auth_methods?.[0]?.auth_identifier}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</DropdownMenuLabel>
|
</DropdownMenuLabel>
|
||||||
<DropdownMenuSeparator />
|
<DropdownMenuSeparator />
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user