diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
new file mode 100644
index 00000000..f49d0739
--- /dev/null
+++ b/.github/workflows/build-test.yml
@@ -0,0 +1,19 @@
+name: build-test
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build-lint-test:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository code
+ uses: actions/checkout@v3
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: yarn
+ cache-dependency-path: 'yarn.lock'
+ - run: yarn
+ - run: yarn build
diff --git a/src/app/(routes)/student/jobs/[jobId]/page.tsx b/src/app/(routes)/student/jobs/[jobId]/page.tsx
index 3cdd18da..c35bb743 100644
--- a/src/app/(routes)/student/jobs/[jobId]/page.tsx
+++ b/src/app/(routes)/student/jobs/[jobId]/page.tsx
@@ -1,7 +1,6 @@
"use client";
import React, { useEffect, useState } from "react";
import { Separator } from "@/components/ui/separator";
-import Link from "next/link";
import {
Table,
TableHeader,
@@ -12,10 +11,10 @@ import {
TableCell,
} from "@/components/ui/table";
import { Button } from "@/components/ui/button";
-import { fetchEachJob } from "@/helpers/api";
import HorizontalTimeline from "@/components/HorizontalTimeline";
import { Job, CustomEvent, EventData, CalenderEvent } from "@/helpers/student/types";
import { GetJobById } from "@/helpers/student/api";
+import Cookies from "js-cookie";
function transformEvents(events: CustomEvent[]): EventData[] {
@@ -96,7 +95,7 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
useEffect(() => {
const fetchJobData = async () => {
- const data = await GetJobById(params.jobId);
+ const data = await GetJobById(params.jobId, Cookies.get("accessToken"));
setJobData(data);
storeCalenderEvents(data);
};
@@ -122,7 +121,7 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
Domain
{" "}
@@ -201,7 +200,6 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
- {/*
*/}
diff --git a/src/app/(routes)/student/jobs/salary/[jobId]/page.tsx b/src/app/(routes)/student/jobs/salary/[jobId]/page.tsx
index f800c79a..be1d7732 100644
--- a/src/app/(routes)/student/jobs/salary/[jobId]/page.tsx
+++ b/src/app/(routes)/student/jobs/salary/[jobId]/page.tsx
@@ -1,18 +1,8 @@
"use client";
import React, { useEffect, useState } from "react";
-import {
- Table,
- TableHeader,
- TableBody,
- TableFooter,
- TableHead,
- TableRow,
- TableCell,
-} from "@/components/ui/table";
-import { SampleJobData } from "@/dummyData/job";
-import { Separator } from "@/components/ui/separator";
import SalaryCard from "@/components/jobs/SalaryCard";
import { GetJobById } from "@/helpers/student/api";
+import Cookies from "js-cookie";
interface Props {}
interface Salary {
@@ -37,7 +27,7 @@ const SalaryPage = ({ params }: { params: { jobId: string } }) => {
useEffect(() => {
const fetchSalaryData = async () => {
- const data = await GetJobById(params.jobId);
+ const data = await GetJobById(params.jobId, Cookies.get("accessToken"));
setSalaryData(data.salaries);
};
diff --git a/src/components/jobs/JobCard.tsx b/src/components/jobs/JobCard.tsx
index f911807d..91a84012 100644
--- a/src/components/jobs/JobCard.tsx
+++ b/src/components/jobs/JobCard.tsx
@@ -17,7 +17,7 @@ import {
import { OnCampusOffers, Salary, Resume } from "@/helpers/student/types";
import { ApplyJob, GetSalaryById } from "@/helpers/student/api";
import Cookies from "js-cookie";
-import toast, { Toaster } from "react-hot-toast";
+import toast from "react-hot-toast";
interface Props {
jobItem: OnCampusOffers;
salaryId: string;
@@ -29,7 +29,7 @@ const JobCard = ({ jobItem, salaryId, resumes }: Props) => {
useEffect(() => {
const fetchSalary = async () => {
- const data = await GetSalaryById(salaryId);
+ const data = await GetSalaryById(salaryId, Cookies.get("accessToken"));
setSalary(data);
console.log(data);
};
diff --git a/src/components/jobs/OffCampusCard.tsx b/src/components/jobs/OffCampusCard.tsx
index 79500b2b..fb2ba907 100644
--- a/src/components/jobs/OffCampusCard.tsx
+++ b/src/components/jobs/OffCampusCard.tsx
@@ -1,22 +1,8 @@
import React from "react";
-import Link from "next/link";
import { Separator } from "../ui/separator";
-import { fetchJobSalary } from "@/helpers/api";
-import { cookies } from "next/headers";
import { useState, useEffect } from 'react';
-import {JobDetails} from "@/dummyData/jobdetails"
import { Button } from "@/components/ui/button";
-import {
- Select,
- SelectContent,
- SelectGroup,
- SelectItem,
- SelectLabel,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select"
import { OffCampusOffer } from "@/helpers/student/types";
-import { GetSalaryById } from "@/helpers/student/api";
interface Props {
jobItem: OffCampusOffer;
}
diff --git a/src/components/jobs/SalaryCard.tsx b/src/components/jobs/SalaryCard.tsx
index 6c129f09..ab37cf89 100644
--- a/src/components/jobs/SalaryCard.tsx
+++ b/src/components/jobs/SalaryCard.tsx
@@ -4,15 +4,14 @@ import {
Table,
TableHeader,
TableBody,
- TableFooter,
TableHead,
TableRow,
TableCell,
} from "@/components/ui/table";
-import { SampleJobData } from "@/dummyData/job";
import { Separator } from "@/components/ui/separator";
import { Salary } from "@/helpers/student/types";
import { GetSalaryById } from "@/helpers/student/api";
+import Cookies from "js-cookie";
interface Props{
salaryId: string;
@@ -23,7 +22,7 @@ export default function SalaryCard({salaryId}: Props) {
useEffect(() => {
const fetchSalaryData = async () => {
- const data = await GetSalaryById(salaryId);
+ const data = await GetSalaryById(salaryId, Cookies.get("accessToken"));
setSalaryData(data);
};
diff --git a/src/helpers/student/api.ts b/src/helpers/student/api.ts
index 4e751bbd..bc14e843 100644
--- a/src/helpers/student/api.ts
+++ b/src/helpers/student/api.ts
@@ -5,9 +5,14 @@ const url = (NextUrl: string) => {
return `${baseUrl}/api/v1${NextUrl}`;
};
-export const GetJobById = async (jobId: string) => {
+export const GetJobById = async (jobId: string, accessToken:string) => {
try {
- const res = await fetch(url(`/jobs/${jobId}`));
+ const res = await fetch(url(`/jobs/${jobId}`),{
+ method: 'GET',
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ },
+ });
if (!res.ok) {
throw new Error("Failed to fetch Job data");
}
@@ -17,9 +22,14 @@ export const GetJobById = async (jobId: string) => {
console.error("Error fetching Job data:", error);
}
};
-export const GetSalaryById = async (salaryId: string) => {
+export const GetSalaryById = async (salaryId: string,accessToken: string) => {
try {
- const res = await fetch(url(`/salaries/${salaryId}`));
+ const res = await fetch(url(`/salaries/${salaryId}`), {
+ method: 'GET',
+ headers: {
+ 'Authorization': `Bearer ${accessToken}`
+ }
+ });
if (!res.ok) {
throw new Error("Failed to fetch salary data");
}