From b2ab623b7c4bd1b162c0ed714caa8bf83df7ef23 Mon Sep 17 00:00:00 2001 From: Abdulkaiz Khatri <24286590+ful1e5@users.noreply.github.com> Date: Tue, 21 Nov 2023 09:02:15 +0530 Subject: [PATCH] fix: call`api.refreshSession()` on each download component load --- src/components/DownloadButton/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/DownloadButton/index.tsx b/src/components/DownloadButton/index.tsx index 2e50417..18bdef5 100644 --- a/src/components/DownloadButton/index.tsx +++ b/src/components/DownloadButton/index.tsx @@ -109,7 +109,7 @@ export const DownloadButton: React.FC = (props) => { headers: { Accept: 'application/json', 'Content-Type': 'application/json', - Authorization: `Bearer ${api.jwt?.token}` + Authorization: `Bearer ${props.token}` }, body: JSON.stringify({ platform, @@ -135,7 +135,7 @@ export const DownloadButton: React.FC = (props) => { setErrorLogs({ text: '' }); - await api.refreshSession(props.token); + // await api.refreshSession(props.token); const { count, total } = await getDownloadCounts(props.token); if ((total && count >= total) || (count === 0 && total === 0)) { setErrorLogs({ text: 'Download Limit Exceeded.' }); @@ -208,7 +208,7 @@ export const DownloadButton: React.FC = (props) => { useEffect(() => { if (lock === false) { - api.deleteSession(); + api.refreshSession(props.token); } }, [lock, props.lock, props.disabled, props.token]); // eslint-disable-line react-hooks/exhaustive-deps