| Auth on view content

This commit is contained in:
rakhimovkamran 2024-10-27 23:18:06 +05:00
parent ed33936e4f
commit 39fef5cb2a
1 changed files with 4 additions and 2 deletions

View File

@ -20,13 +20,15 @@ export const ViewContentPage = () => {
const auth = useAuth();
useEffect(() => {
void auth.mutateAsync()
}, []);
const handleBuyContent = useCallback(async () => {
try {
if (!tonConnectUI.connected) {
await tonConnectUI.openModal();
await auth.mutateAsync();
return
}
@ -57,7 +59,7 @@ export const ViewContentPage = () => {
} catch (error) {
console.error("Error handling Ton Connect subscription:", error);
}
}, [content]);
}, [content, tonConnectUI.connected]);
const haveLicense = useMemo(() => {
return content?.data?.have_licenses?.includes("listen") || content?.data?.have_licenses?.includes("resale")