Hard coded the URL

This commit is contained in:
Tiago Ribeiro
2024-03-13 23:58:56 +00:00
parent a24a8ec097
commit 3c5629f83a

View File

@@ -1,7 +1,7 @@
import Footer from "@/components/Footer";
import Navbar from "@/components/Navbar";
import Title from "@/components/Title";
import { Contact } from "@/types/contact";
import {Contact} from "@/types/contact";
import translation from "@/translation/agentcontacts.json";
type Language = "en" | "ar";
@@ -12,9 +12,7 @@ interface Props {
}
async function getCountryManagers(country: string, language: Language = "en") {
const res = await fetch(
`${process.env.NEXT_PUBLIC_APP_URL}/api/users/agents/${country}?language=${language}`
);
const res = await fetch(`https://platform.encoach.com/api/users/agents/${country}?language=${language}`);
if (!res.ok) {
throw new Error("Failed to fetch contacts");
@@ -24,14 +22,12 @@ async function getCountryManagers(country: string, language: Language = "en") {
}
export async function generateStaticParamsHelper(language: Language = "en") {
const contacts = (await fetch(
`${process.env.NEXT_PUBLIC_APP_URL}/api/users/agents?language=${language}`
).then((res) => res.json())) as Contact[];
return contacts.map(({ key }) => ({
const contacts = (await fetch(`https://platform.encoach.com/api/users/agents?language=${language}`).then((res) => res.json())) as Contact[];
return contacts.map(({key}) => ({
country: key.toLowerCase().replaceAll(" ", ""),
}));
}
export async function AgentContacts({ language, page, country }: Props) {
export async function AgentContacts({language, page, country}: Props) {
const contact = (await getCountryManagers(country, language)) as Contact;
return (