payment bug fixed
This commit is contained in:
@@ -62,6 +62,7 @@
|
|||||||
"amount": "Amount",
|
"amount": "Amount",
|
||||||
"result": "Result",
|
"result": "Result",
|
||||||
"actions": "",
|
"actions": "",
|
||||||
|
"state": "Payment status",
|
||||||
"emptyMessage": "No plagiarism checks found.",
|
"emptyMessage": "No plagiarism checks found.",
|
||||||
"tryAgain": "Try again",
|
"tryAgain": "Try again",
|
||||||
"view": "View",
|
"view": "View",
|
||||||
@@ -121,7 +122,9 @@
|
|||||||
"certificateId": "Certificate ID",
|
"certificateId": "Certificate ID",
|
||||||
"downloadCertificate": "Download Certificate",
|
"downloadCertificate": "Download Certificate",
|
||||||
"unknownError": "Unknown error",
|
"unknownError": "Unknown error",
|
||||||
"words": "words"
|
"words": "words",
|
||||||
|
"aiProbabilityText": "Probability that the text was generated with AI has been detected",
|
||||||
|
"documentNumber": "Document subject"
|
||||||
},
|
},
|
||||||
"Hero": {
|
"Hero": {
|
||||||
"badge": "Academic Integrity Platform",
|
"badge": "Academic Integrity Platform",
|
||||||
@@ -228,6 +231,7 @@
|
|||||||
"serviceFee": "Service fee",
|
"serviceFee": "Service fee",
|
||||||
"certificateLabel": "Certificate",
|
"certificateLabel": "Certificate",
|
||||||
"total": "Total",
|
"total": "Total",
|
||||||
|
"paymentRequired": "Payment not completed",
|
||||||
"connecting": "Connecting to Payme…",
|
"connecting": "Connecting to Payme…",
|
||||||
"payButton": "Pay with Payme"
|
"payButton": "Pay with Payme"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
"amount": "Сумма",
|
"amount": "Сумма",
|
||||||
"result": "Результат",
|
"result": "Результат",
|
||||||
"actions": "",
|
"actions": "",
|
||||||
|
"state": "Статус оплаты",
|
||||||
"emptyMessage": "Проверки на плагиат не найдены.",
|
"emptyMessage": "Проверки на плагиат не найдены.",
|
||||||
"tryAgain": "Попробовать снова",
|
"tryAgain": "Попробовать снова",
|
||||||
"view": "Просмотр",
|
"view": "Просмотр",
|
||||||
@@ -121,7 +122,9 @@
|
|||||||
"certificateId": "ID сертификата",
|
"certificateId": "ID сертификата",
|
||||||
"downloadCertificate": "Скачать сертификат",
|
"downloadCertificate": "Скачать сертификат",
|
||||||
"unknownError": "Неизвестная ошибка",
|
"unknownError": "Неизвестная ошибка",
|
||||||
"words": "слов"
|
"words": "слов",
|
||||||
|
"aiProbabilityText": "Обнаружена вероятность того, что текст создан с помощью ИИ",
|
||||||
|
"documentNumber": "Тема документа"
|
||||||
},
|
},
|
||||||
"Hero": {
|
"Hero": {
|
||||||
"badge": "Платформа академической честности",
|
"badge": "Платформа академической честности",
|
||||||
@@ -228,6 +231,7 @@
|
|||||||
"serviceFee": "Стоимость услуги",
|
"serviceFee": "Стоимость услуги",
|
||||||
"certificateLabel": "Сертификат",
|
"certificateLabel": "Сертификат",
|
||||||
"total": "Итого",
|
"total": "Итого",
|
||||||
|
"paymentRequired": "Оплата не произведена",
|
||||||
"connecting": "Подключение к Payme…",
|
"connecting": "Подключение к Payme…",
|
||||||
"payButton": "Оплатить через Payme"
|
"payButton": "Оплатить через Payme"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ declare const messages: {
|
|||||||
amount: 'Summa';
|
amount: 'Summa';
|
||||||
result: 'Natija';
|
result: 'Natija';
|
||||||
actions: '';
|
actions: '';
|
||||||
|
state: "To'lov holati";
|
||||||
emptyMessage: 'Plagiat tekshiruvlari topilmadi.';
|
emptyMessage: 'Plagiat tekshiruvlari topilmadi.';
|
||||||
tryAgain: "Qayta urinib ko'ring";
|
tryAgain: "Qayta urinib ko'ring";
|
||||||
view: "Ko'rish";
|
view: "Ko'rish";
|
||||||
@@ -125,6 +126,8 @@ declare const messages: {
|
|||||||
downloadCertificate: 'Sertifikatni yuklab olish';
|
downloadCertificate: 'Sertifikatni yuklab olish';
|
||||||
unknownError: "Noma'lum xato";
|
unknownError: "Noma'lum xato";
|
||||||
words: "so'z";
|
words: "so'z";
|
||||||
|
aiProbabilityText: 'Ai yordamida yaratilganlik ehtimoli aniqlandi';
|
||||||
|
documentNumber: 'Dokument mavzusi';
|
||||||
};
|
};
|
||||||
Hero: {
|
Hero: {
|
||||||
badge: 'Akademik halollik platformasi';
|
badge: 'Akademik halollik platformasi';
|
||||||
@@ -231,6 +234,7 @@ declare const messages: {
|
|||||||
serviceFee: "Xizmat to'lovi";
|
serviceFee: "Xizmat to'lovi";
|
||||||
certificateLabel: 'Sertifikat';
|
certificateLabel: 'Sertifikat';
|
||||||
total: 'Jami';
|
total: 'Jami';
|
||||||
|
paymentRequired: "To'lov qilinmagan";
|
||||||
connecting: 'Paymega ulanmoqda…';
|
connecting: 'Paymega ulanmoqda…';
|
||||||
payButton: "Payme orqali to'lash";
|
payButton: "Payme orqali to'lash";
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
"amount": "Summa",
|
"amount": "Summa",
|
||||||
"result": "Natija",
|
"result": "Natija",
|
||||||
"actions": "",
|
"actions": "",
|
||||||
|
"state": "To'lov holati",
|
||||||
"emptyMessage": "Plagiat tekshiruvlari topilmadi.",
|
"emptyMessage": "Plagiat tekshiruvlari topilmadi.",
|
||||||
"tryAgain": "Qayta urinib ko'ring",
|
"tryAgain": "Qayta urinib ko'ring",
|
||||||
"view": "Ko'rish",
|
"view": "Ko'rish",
|
||||||
@@ -121,7 +122,9 @@
|
|||||||
"certificateId": "Sertifikat ID",
|
"certificateId": "Sertifikat ID",
|
||||||
"downloadCertificate": "Sertifikatni yuklab olish",
|
"downloadCertificate": "Sertifikatni yuklab olish",
|
||||||
"unknownError": "Noma'lum xato",
|
"unknownError": "Noma'lum xato",
|
||||||
"words": "so'z"
|
"words": "so'z",
|
||||||
|
"aiProbabilityText":"Ai yordamida yaratilganlik ehtimoli aniqlandi",
|
||||||
|
"documentNumber":"Dokument mavzusi"
|
||||||
},
|
},
|
||||||
"Hero": {
|
"Hero": {
|
||||||
"badge": "Akademik halollik platformasi",
|
"badge": "Akademik halollik platformasi",
|
||||||
@@ -228,6 +231,7 @@
|
|||||||
"serviceFee": "Xizmat to'lovi",
|
"serviceFee": "Xizmat to'lovi",
|
||||||
"certificateLabel": "Sertifikat",
|
"certificateLabel": "Sertifikat",
|
||||||
"total": "Jami",
|
"total": "Jami",
|
||||||
|
"paymentRequired":"To'lov qilinmagan",
|
||||||
"connecting": "Paymega ulanmoqda…",
|
"connecting": "Paymega ulanmoqda…",
|
||||||
"payButton": "Payme orqali to'lash"
|
"payButton": "Payme orqali to'lash"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { useParams } from 'next/navigation';
|
|||||||
import { links } from '@/shared/request/links';
|
import { links } from '@/shared/request/links';
|
||||||
import { apiRequest } from '@/shared/request/apiRequest';
|
import { apiRequest } from '@/shared/request/apiRequest';
|
||||||
import Sertifikat from './sertifikat';
|
import Sertifikat from './sertifikat';
|
||||||
|
import PaymentStatus from './paidStatus';
|
||||||
|
|
||||||
// ── Types ────────────────────────────────────────────────────────────────────
|
// ── Types ────────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
@@ -46,6 +47,7 @@ interface Document {
|
|||||||
text: string;
|
text: string;
|
||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
|
state: 'paid' | 'unpaid';
|
||||||
results: Result[];
|
results: Result[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,6 +396,7 @@ export default function DocumentDetailPage({ id }: { id: number }) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
|
<PaymentStatus status={doc.state} />
|
||||||
{doc.certificate && <Sertifikat document_id={Number(id)} />}
|
{doc.certificate && <Sertifikat document_id={Number(id)} />}
|
||||||
{doc.file && (
|
{doc.file && (
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -157,7 +157,9 @@ export function usePlagiarismForm() {
|
|||||||
form,
|
form,
|
||||||
errors,
|
errors,
|
||||||
submission,
|
submission,
|
||||||
senderFullName: user ? `${user?.name} ${user?.surname}` : null,
|
senderFullName: localUser
|
||||||
|
? `${localUser?.name} ${localUser?.surname}`
|
||||||
|
: null,
|
||||||
isLoading,
|
isLoading,
|
||||||
setTopic,
|
setTopic,
|
||||||
setFile,
|
setFile,
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ export const TABLE_COLUMNS = [
|
|||||||
{ key: 'senderFullName', labelKey: 'sender' },
|
{ key: 'senderFullName', labelKey: 'sender' },
|
||||||
{ key: 'fileName', labelKey: 'file' },
|
{ key: 'fileName', labelKey: 'file' },
|
||||||
{ key: 'date', labelKey: 'date' },
|
{ key: 'date', labelKey: 'date' },
|
||||||
{ key: 'result', labelKey: 'result' },
|
{ key: 'state', labelKey: 'state' },
|
||||||
{ key: 'actions', labelKey: 'actions' },
|
{ key: 'actions', labelKey: 'actions' },
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ export interface DocumentData {
|
|||||||
created_at: string;
|
created_at: string;
|
||||||
updated_at: string;
|
updated_at: string;
|
||||||
results: [];
|
results: [];
|
||||||
|
state: 'paid' | 'unpaid';
|
||||||
|
order_id: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface PlagiarismCheckDetail extends DocumentData {
|
export interface PlagiarismCheckDetail extends DocumentData {
|
||||||
|
|||||||
@@ -1,104 +1,171 @@
|
|||||||
'use client';
|
'use client';
|
||||||
import React from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useTranslations } from 'next-intl';
|
import { useTranslations } from 'next-intl';
|
||||||
import { HistoryTableRowProps } from '../lib/types';
|
import { HistoryTableRowProps } from '../lib/types';
|
||||||
import { formatDate } from '../lib/utils';
|
import { formatDate } from '../lib/utils';
|
||||||
import { ResultBadge } from './resultBadge';
|
|
||||||
import { useRouter } from '@/shared/config/i18n/navigation';
|
import { useRouter } from '@/shared/config/i18n/navigation';
|
||||||
import { useUserPlagiatStore } from '@/shared/zustand/user';
|
import { useUserPlagiatStore } from '@/shared/zustand/user';
|
||||||
|
import PaymentStatus from '@/widgets/detail/paidStatus';
|
||||||
|
import { PaymentModal } from '@/widgets/paymentModal/ui/Paymentmodal';
|
||||||
|
import { useMutation } from '@tanstack/react-query';
|
||||||
|
import { apiRequest } from '@/shared/request/apiRequest';
|
||||||
|
import { links } from '@/shared/request/links';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
export const HistoryTableRow: React.FC<HistoryTableRowProps> = ({ item }) => {
|
export const HistoryTableRow: React.FC<HistoryTableRowProps> = ({ item }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslations('HistoryPage');
|
const t = useTranslations('HistoryPage');
|
||||||
|
const tPay = useTranslations('Payment');
|
||||||
const tUnknown = useTranslations();
|
const tUnknown = useTranslations();
|
||||||
const user = useUserPlagiatStore((state) => state.user);
|
const user = useUserPlagiatStore((state) => state.user);
|
||||||
|
const [isPaymentOpen, setIsPaymentOpen] = useState(false);
|
||||||
|
const [localUser, setLocalUser] = useState<{
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
surname: string;
|
||||||
|
} | null>(null);
|
||||||
|
|
||||||
const userName = user
|
useEffect(() => {
|
||||||
? `${user.name} ${user.surname}`
|
const data = localStorage.getItem('user');
|
||||||
|
|
||||||
|
if (data) {
|
||||||
|
setLocalUser(JSON.parse(data));
|
||||||
|
} else {
|
||||||
|
setLocalUser(null);
|
||||||
|
}
|
||||||
|
}, [user]);
|
||||||
|
|
||||||
|
const userName = localUser
|
||||||
|
? `${localUser.name} ${localUser.surname}`
|
||||||
: tUnknown('unknownUser');
|
: tUnknown('unknownUser');
|
||||||
|
|
||||||
|
const payment = useMutation({
|
||||||
|
mutationKey: ['payload'],
|
||||||
|
mutationFn: ({ order_id }: { order_id: number }) =>
|
||||||
|
apiRequest<{ payment_link: string }>('POST', links.payment(order_id)),
|
||||||
|
onSuccess: (res) => {
|
||||||
|
console.log('payment res: ', res);
|
||||||
|
window.open(res.data.payment_link, '_self');
|
||||||
|
//route.push(`/${document_id}`);
|
||||||
|
setIsPaymentOpen(false);
|
||||||
|
},
|
||||||
|
onError: (err) => {
|
||||||
|
const message =
|
||||||
|
err instanceof Error ? err.message : 'An unexpected error occurred.';
|
||||||
|
toast.error(message);
|
||||||
|
setIsPaymentOpen(false);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const handleSubmit = ({ document_id }: { document_id: number }) => {
|
||||||
|
payment.mutate({ order_id: document_id });
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<tr className="border-b border-slate-100 hover:bg-slate-50/70 transition-colors duration-100 group">
|
<>
|
||||||
{/* Sender */}
|
<tr className="border-b border-slate-100 hover:bg-slate-50/70 transition-colors duration-100 group">
|
||||||
<td className="px-4 py-3.5">
|
{/* Sender */}
|
||||||
<span className="text-sm font-medium text-slate-800 whitespace-nowrap">
|
<td className="px-4 py-3.5">
|
||||||
{userName}
|
<span className="text-sm font-medium text-slate-800 whitespace-nowrap">
|
||||||
</span>
|
{userName}
|
||||||
</td>
|
|
||||||
|
|
||||||
{/* File Name */}
|
|
||||||
<td className="px-4 py-3.5">
|
|
||||||
<a
|
|
||||||
href={item.file}
|
|
||||||
target="_blank"
|
|
||||||
className="flex items-center gap-2 underline"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
width="14"
|
|
||||||
height="14"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="1.75"
|
|
||||||
className="text-slate-400 shrink-0"
|
|
||||||
>
|
|
||||||
<path d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
|
||||||
</svg>
|
|
||||||
<span className="text-sm text-slate-600 font-mono" title={item.file}>
|
|
||||||
{tUnknown('file')}
|
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</td>
|
||||||
</td>
|
|
||||||
|
|
||||||
{/* Date */}
|
{/* File Name */}
|
||||||
<td className="px-4 py-3.5">
|
<td className="px-4 py-3.5">
|
||||||
<span className="text-sm text-slate-500 whitespace-nowrap">
|
<a
|
||||||
{formatDate(item.created_at)}
|
href={item.file}
|
||||||
</span>
|
target="_blank"
|
||||||
</td>
|
className="flex items-center gap-2 underline"
|
||||||
|
|
||||||
{/* Amount */}
|
|
||||||
{/* <td className="px-4 py-3.5">
|
|
||||||
<span className="text-sm font-medium text-slate-700 whitespace-nowrap tabular-nums">
|
|
||||||
{item.} UZS
|
|
||||||
</span>
|
|
||||||
</td> */}
|
|
||||||
|
|
||||||
{/* Result */}
|
|
||||||
<td className="px-4 py-3.5">
|
|
||||||
<ResultBadge result={'clean'} />
|
|
||||||
</td>
|
|
||||||
|
|
||||||
{/* View Button */}
|
|
||||||
<td className="px-4 py-3.5 text-right">
|
|
||||||
<button
|
|
||||||
onClick={() => router.push(`/${item.id}`)}
|
|
||||||
aria-label={t('viewDetails', { sender: item.title })}
|
|
||||||
className="
|
|
||||||
inline-flex items-center gap-1.5 px-3 py-1.5
|
|
||||||
text-xs font-medium text-slate-600
|
|
||||||
bg-white border border-slate-200 rounded-lg
|
|
||||||
hover:border-slate-300 hover:text-slate-900 hover:bg-slate-50
|
|
||||||
active:scale-95
|
|
||||||
transition-all duration-150
|
|
||||||
focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300
|
|
||||||
"
|
|
||||||
>
|
|
||||||
{t('view')}
|
|
||||||
<svg
|
|
||||||
width="11"
|
|
||||||
height="11"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
fill="none"
|
|
||||||
stroke="currentColor"
|
|
||||||
strokeWidth="2.5"
|
|
||||||
strokeLinecap="round"
|
|
||||||
strokeLinejoin="round"
|
|
||||||
>
|
>
|
||||||
<path d="M5 12h14M12 5l7 7-7 7" />
|
<svg
|
||||||
</svg>
|
width="14"
|
||||||
</button>
|
height="14"
|
||||||
</td>
|
viewBox="0 0 24 24"
|
||||||
</tr>
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="1.75"
|
||||||
|
className="text-slate-400 shrink-0"
|
||||||
|
>
|
||||||
|
<path d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||||
|
</svg>
|
||||||
|
<span
|
||||||
|
className="text-sm text-slate-600 font-mono"
|
||||||
|
title={item.file}
|
||||||
|
>
|
||||||
|
{tUnknown('file')}
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* Date */}
|
||||||
|
<td className="px-4 py-3.5">
|
||||||
|
<span className="text-sm text-slate-500 whitespace-nowrap">
|
||||||
|
{formatDate(item.created_at)}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* State */}
|
||||||
|
<td className="px-4 py-3.5">
|
||||||
|
<span
|
||||||
|
onClick={() => {
|
||||||
|
if (item.state === 'unpaid') {
|
||||||
|
setIsPaymentOpen(true);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
className="text-sm font-medium text-slate-700 whitespace-nowrap tabular-nums"
|
||||||
|
>
|
||||||
|
<PaymentStatus status={item.state} />
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
{/* View Button */}
|
||||||
|
<td className="px-4 py-3.5 text-right">
|
||||||
|
<button
|
||||||
|
onClick={() => {
|
||||||
|
if (item.state === 'paid') {
|
||||||
|
router.push(`/${item.id}`);
|
||||||
|
} else {
|
||||||
|
toast.error(tPay('paymentRequired'));
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
aria-label={t('viewDetails', { sender: item.title })}
|
||||||
|
className="
|
||||||
|
inline-flex items-center gap-1.5 px-3 py-1.5
|
||||||
|
text-xs font-medium text-slate-600
|
||||||
|
bg-white border border-slate-200 rounded-lg
|
||||||
|
hover:border-slate-300 hover:text-slate-900 hover:bg-slate-50
|
||||||
|
active:scale-95
|
||||||
|
transition-all duration-150
|
||||||
|
focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{t('view')}
|
||||||
|
<svg
|
||||||
|
width="11"
|
||||||
|
height="11"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
fill="none"
|
||||||
|
stroke="currentColor"
|
||||||
|
strokeWidth="2.5"
|
||||||
|
strokeLinecap="round"
|
||||||
|
strokeLinejoin="round"
|
||||||
|
>
|
||||||
|
<path d="M5 12h14M12 5l7 7-7 7" />
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<PaymentModal
|
||||||
|
isOpen={isPaymentOpen}
|
||||||
|
onClose={() => setIsPaymentOpen(false)}
|
||||||
|
hasCertificate={false}
|
||||||
|
onConfirmPayment={() => {
|
||||||
|
handleSubmit({ document_id: Number(item.order_id) });
|
||||||
|
}}
|
||||||
|
isLoading={payment.isPending}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
import { MenuItem } from '../lib/model';
|
import { MenuItem } from '../lib/model';
|
||||||
|
|
||||||
const SubMenuLink = ({ item }: { item: MenuItem }) => {
|
const SubMenuLink = ({
|
||||||
|
item,
|
||||||
|
logOut,
|
||||||
|
}: {
|
||||||
|
item: MenuItem;
|
||||||
|
logOut: () => void;
|
||||||
|
}) => {
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
className="flex flex-row gap-4 rounded-md p-3 leading-none no-underline transition-colors outline-none select-none hover:bg-muted hover:text-accent-foreground"
|
className="flex flex-row gap-4 rounded-md p-3 leading-none no-underline transition-colors outline-none select-none hover:bg-muted hover:text-accent-foreground"
|
||||||
href={item.url}
|
href={item.url}
|
||||||
|
onClick={logOut}
|
||||||
>
|
>
|
||||||
<div className="text-foreground">
|
<div className="text-foreground">
|
||||||
{item.icon && <item.icon className="size-5 shrink-0" />}
|
{item.icon && <item.icon className="size-5 shrink-0" />}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ function AuthButtons() {
|
|||||||
localStorage.removeItem('access');
|
localStorage.removeItem('access');
|
||||||
localStorage.removeItem('refresh');
|
localStorage.removeItem('refresh');
|
||||||
localStorage.removeItem('user');
|
localStorage.removeItem('user');
|
||||||
|
clearUser();
|
||||||
};
|
};
|
||||||
console.log('Current user:', user);
|
console.log('Current user:', user);
|
||||||
|
|
||||||
@@ -71,12 +72,8 @@ function AuthButtons() {
|
|||||||
asChild
|
asChild
|
||||||
key={subItem.title}
|
key={subItem.title}
|
||||||
className="w-80"
|
className="w-80"
|
||||||
onClick={() => {
|
|
||||||
clearTokens();
|
|
||||||
clearUser();
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<SubMenuLink item={subItem} />
|
<SubMenuLink logOut={clearTokens} item={subItem} />
|
||||||
</NavigationMenuLink>
|
</NavigationMenuLink>
|
||||||
))}
|
))}
|
||||||
</NavigationMenuContent>
|
</NavigationMenuContent>
|
||||||
|
|||||||
Reference in New Issue
Block a user