From 77c587681b4b8b11f9eb037d6e7a4b5780a34ed6 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Thu, 24 Nov 2022 22:25:23 +0100 Subject: [PATCH] using fetch instead of axios, should fix the issue --- client/services/resume.ts | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/client/services/resume.ts b/client/services/resume.ts index b8e61810..d39ba977 100644 --- a/client/services/resume.ts +++ b/client/services/resume.ts @@ -63,28 +63,13 @@ export const fetchResumeByIdentifier = async ({ options = { secretKey: '' }, }: FetchResumeByIdentifierParams) => { if (!isBrowser) { + const serverUrl = env('SERVER_URL'); const secretKey = options.secretKey; - const resume = await axios - .get(`/resume/${username}/${slug}`, { params: { secretKey } }) - .then((res) => res.data); - - console.log('ResumeService~fetchResumeByIdentifier', 'using axios', JSON.stringify(resume)); - - const resumeJSON = await fetch(env('SERVER_URL') + `/resume/${username}/${slug}?secretKey=${secretKey}`).then( - (response) => response.json() - ); - - console.log('ResumeService~fetchResumeByIdentifier', 'using fetch', JSON.stringify(resumeJSON)); - - return resume; + return fetch(`${serverUrl}/resume/${username}/${slug}?secretKey=${secretKey}`).then((response) => response.json()); } - const resume = await axios.get(`/resume/${username}/${slug}`).then((res) => res.data); - - console.log('ResumeService~fetchResumeByIdentifier', 'isBrowser', JSON.stringify(resume)); - - return resume; + return axios.get(`/resume/${username}/${slug}`).then((res) => res.data); }; export const fetchResumeByShortId = async ({ shortId }: FetchResumeByShortIdParams) =>