Skip to content

Commit

Permalink
feat: add base url
Browse files Browse the repository at this point in the history
  • Loading branch information
Goketech committed Aug 1, 2024
1 parent 2c2c928 commit 20863c2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/(landing-routes)/career/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useRouter } from "next/navigation";
import { useEffect, useState } from "react";
import { getApiUrl } from "~/utils/getApiUrl";

import CareerCardParent from "~/components/common/CareerCard";
import { Job } from "~/components/common/CareerCard/Jobs";
Expand All @@ -10,18 +11,23 @@ import Nojobs from "./Nojobs";

export default function Career() {
const [allJobs, setAllJobs] = useState<Job[]>([]);
const [baseUrl, setBaseUrl] = useState<string>("");
const [displayedJobs, setDisplayedJobs] = useState<Job[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [currentPage, setCurrentPage] = useState(1);
const pageSize = 6;
const router = useRouter();

useEffect(() => {
getApiUrl().then(url => setBaseUrl(url));
}, []);

useEffect(() => {
const fetchJobs = async () => {
setIsLoading(true);
try {
const response = await fetch(
`https://deployment.api-nestjs.boilerplate.hng.tech/api/v1/jobs`,
`${baseUrl}/api/v1/jobs`,
{
method: "GET",
headers: {
Expand Down

0 comments on commit 20863c2

Please sign in to comment.