| Auth on view content

This commit is contained in:
rakhimovkamran 2024-10-27 19:13:36 +05:00
parent a9111959cd
commit 71284b722c
3 changed files with 41 additions and 18 deletions

View File

@ -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 (

View File

@ -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') ?? ""
}
});
},
);

View File

@ -21,6 +21,7 @@ export const useUploadFile = () => {
}>("/storage", formData, {
headers: {
"Content-Type": "multipart/form-data",
Authorization: localStorage.getItem('auth_v1_token') ?? ""
},
onUploadProgress: (progressEvent) => {