| Auth on view content
This commit is contained in:
parent
ed33936e4f
commit
39fef5cb2a
|
|
@ -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")
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue