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