Skip to content

Commit

Permalink
updated query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Princekumarofficial committed Jul 10, 2024
1 parent 7fefacb commit db0c8f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/app/(routes)/admin/jobs/[jobId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
import { fetchEachJob } from "@/helpers/api";
import Cookies from "js-cookie";
import { CircularProgress } from "@mui/material";
import Loader from "@/components/Loader/loader";
import toast from "react-hot-toast";

const JobDetailPage = ({ params }: { params: { jobId: string } }) => {
const [job, setData] = useState<JobDetailFC>(null);
Expand All @@ -33,13 +35,11 @@ const JobDetailPage = ({ params }: { params: { jobId: string } }) => {
getJafDetails(),
]);

console.log(jobDetailData);

setJafDetails((prev) => jafDetailsData);
setData(jobDetailData);
setFormData(jobDetailData);
} catch (error) {
console.error("Error fetching data:", error);
toast.error("Error fetching data");
} finally {
setLoading(false);
}
Expand Down Expand Up @@ -96,7 +96,7 @@ const JobDetailPage = ({ params }: { params: { jobId: string } }) => {
{loading && (
<div className="w-full h-full flex justify-center items-center">
<div className="px-28 py-16 bg-white">
<CircularProgress />
<Loader />
</div>
</div>
)}
Expand Down
7 changes: 4 additions & 3 deletions src/app/(routes)/admin/jobs/events/[jobId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { fetchJobEvents } from "@/helpers/api";
import { EventFC } from "@/helpers/recruiter/types";
import { Button } from "@/components/ui/button";
import { AddEvent } from "@/components/Admin/JobEvents";
import Loader from "@/components/Loader/loader";
import toast from "react-hot-toast";

const EventsPage = ({ params }: { params: { jobId: string } }) => {
const [events, setData] = useState<[EventFC]>(null);
Expand All @@ -17,10 +19,9 @@ const EventsPage = ({ params }: { params: { jobId: string } }) => {
const fetchData = async () => {
try {
const jsonData = await fetchJobEvents(params.jobId);
console.log(jsonData);
setData(jsonData);
} catch (error) {
console.log(error);
toast.error("Some error occured");
} finally {
setLoading(false);
}
Expand Down Expand Up @@ -51,7 +52,7 @@ const EventsPage = ({ params }: { params: { jobId: string } }) => {
</div>
{loading && (
<div className="w-full flex justify-center">
<CircularProgress />
<Loader />
</div>
)}
{events && (
Expand Down
18 changes: 13 additions & 5 deletions src/helpers/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,19 @@ export const fetchEachJob = async (
};

export const fetchJobEvents = async (jobId: any) => {
return apiCall(
`/events?q%5BfilterBy%5D[job][id][eq]=${jobId}&q%5BfilterBy%5D[job][id][eq]=${jobId}`
);
return apiCall(`/events`, {
queryParam: {
q: {
filterBy: {
job: {
id: {
eq: [jobId],
},
},
},
},
},
});
};

export const fetchEventById = async (eventId: any) => {
Expand All @@ -275,7 +285,6 @@ export const addEvent = async (body: any) => {
});
};


export const promoteStudent = async (body: any, eventId: string) => {
return apiCall(`/events/${eventId}`, {
method: "PATCH",
Expand Down Expand Up @@ -319,4 +328,3 @@ export const patchResumeVerify = async (changes: ResumePatchData[]) => {
body: changes,
});
};

0 comments on commit db0c8f3

Please sign in to comment.