it has been four days and i am still stuck.
regarding this issue i saw some people saying use axios, and set the timeout. Or change the http to https when you are fetching data, but all that in vain. I am four days behind the deadline and the client will kill me
i am trying vercel build but it says that prerendering error. Here is and example of a request:
import { PageInfo, Social } from "@/typing";
import axios from "axios";
export const fetchSocials = async() => {
const res = await axios.get(`https://localhost:3000/api/getSocials`,{
timeout: 7000,
});
return res.data.socials as Social[];
}
(timeout: 7000 hahaha i am frustrated to the extent i gave it 7 seconds to be able to fetch, lol) this is the previous version (didn't work as well) :
import { PageInfo, Social } from "@/typing";
export const fetchSocials = async() => {
const res = await fetch(`https://localhost:3000/api/getSocials`);
const data = res.json();
const socials: Social[] = data;
return socials;
}
First of all it's http not https on localhost
Secondly you didn't really explain what you're trying to do but from the looks of it you're making an API request in next.js api routes to get data from another endpoint and return the data if that's what you're trying to do I'll say test the endpoint first using postman or a vscode extension like Rest Client to ensure the issue isn't from your server