using fetch instead of axios, server side

This commit is contained in:
Amruth Pillai
2022-11-24 22:14:01 +01:00
parent 7238a3b50e
commit e9a5f86a6a

View File

@ -1,3 +1,4 @@
import env from '@beam-australia/react-env';
import { Resume } from '@reactive-resume/schema'; import { Resume } from '@reactive-resume/schema';
import { AxiosResponse } from 'axios'; import { AxiosResponse } from 'axios';
@ -68,7 +69,13 @@ export const fetchResumeByIdentifier = async ({
.get<Resume>(`/resume/${username}/${slug}`, { params: { secretKey } }) .get<Resume>(`/resume/${username}/${slug}`, { params: { secretKey } })
.then((res) => res.data); .then((res) => res.data);
console.log('ResumeService~fetchResumeByIdentifier', 'isNotBrowser', JSON.stringify(resume)); console.log('ResumeService~fetchResumeByIdentifier', 'using axios', JSON.stringify(resume));
const resumeJSON = 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 resume;
} }