| Auth on view content
This commit is contained in:
parent
a9111959cd
commit
71284b722c
|
|
@ -28,25 +28,35 @@ export const WelcomeStep = ({ nextStep }: WelcomeStepProps) => {
|
|||
}
|
||||
};
|
||||
|
||||
// useEffect(() => {
|
||||
// const first = setTimeout(async () => {
|
||||
// console.log("💩💩💩 call auth");
|
||||
// await auth.mutateAsync();
|
||||
// }, 1000);
|
||||
//
|
||||
// const second = setTimeout(() => {
|
||||
// setLoaded(true);
|
||||
//
|
||||
// if (tonConnectUI.connected) {
|
||||
// nextStep();
|
||||
// }
|
||||
// }, 4000);
|
||||
//
|
||||
// return () => {
|
||||
// clearTimeout(first);
|
||||
// clearTimeout(second);
|
||||
// };
|
||||
// }, [tonConnectUI.connected]);
|
||||
|
||||
useEffect(() => {
|
||||
const first = setTimeout(async () => {
|
||||
console.log("💩💩💩 call auth");
|
||||
await auth.mutateAsync();
|
||||
}, 1000);
|
||||
|
||||
const second = setTimeout(() => {
|
||||
setLoaded(true);
|
||||
|
||||
if (tonConnectUI.connected) {
|
||||
nextStep();
|
||||
}
|
||||
}, 4000);
|
||||
const timeout = setTimeout(() => {
|
||||
setLoaded(true)
|
||||
}, 5000);
|
||||
|
||||
return () => {
|
||||
clearTimeout(first);
|
||||
clearTimeout(second);
|
||||
};
|
||||
}, [tonConnectUI.connected]);
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
}, []);
|
||||
|
||||
if (!isLoaded) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -23,7 +23,11 @@ export const useCreateNewContent = () => {
|
|||
address: string;
|
||||
amount: string;
|
||||
payload: string;
|
||||
}>("/blockchain.sendNewContentMessage", payload);
|
||||
}>("/blockchain.sendNewContentMessage", payload, {
|
||||
headers: {
|
||||
Authorization: localStorage.getItem('auth_v1_token') ?? ""
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
};
|
||||
|
|
@ -41,7 +45,11 @@ export const useCreateNewContent = () => {
|
|||
|
||||
export const useViewContent = (contentId: string) => {
|
||||
return useQuery(["view", "content", contentId], () => {
|
||||
return request.get(`/content.view/${contentId}`);
|
||||
return request.get(`/content.view/${contentId}`, {
|
||||
headers: {
|
||||
Authorization: localStorage.getItem('auth_v1_token') ?? ""
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -62,6 +70,10 @@ export const usePurchaseContent = () => {
|
|||
}>("/blockchain.sendPurchaseContentMessage", {
|
||||
content_address,
|
||||
license_type,
|
||||
}, {
|
||||
headers: {
|
||||
Authorization: localStorage.getItem('auth_v1_token') ?? ""
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ export const useUploadFile = () => {
|
|||
}>("/storage", formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
Authorization: localStorage.getItem('auth_v1_token') ?? ""
|
||||
},
|
||||
|
||||
onUploadProgress: (progressEvent) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue