Skip to content

Commit

Permalink
build test
Browse files Browse the repository at this point in the history
  • Loading branch information
ishaan-tf authored and mittal-ishaan committed Jun 15, 2024
1 parent 40afc81 commit 6fec724
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 9 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -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
8 changes: 3 additions & 5 deletions src/app/(routes)/student/jobs/[jobId]/page.tsx
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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[] {

Expand Down Expand Up @@ -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);
};
Expand All @@ -122,7 +121,7 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
<div className="grid md:grid-cols-2 lg:grid-cols-5 text-sm mx-2">
<div>
<div className="text-gray-500 font-semibold my-2">Website</div>{" "}
<a className="text-blue-500" href={jobData.companyDetailsFilled.website} target="_blank" rel="noopener noreferrer">Link</a>
<a className="text-blue-500" href={jobData?.companyDetailsFilled.website} target="_blank" rel="noopener noreferrer">Link</a>
</div>
<div>
<div className="text-gray-500 font-semibold my-2">Domain</div>{" "}
Expand Down Expand Up @@ -201,7 +200,6 @@ const JobPage = ({ params }: { params: { jobId: string } }) => {
<Separator />
</div>
<HorizontalTimeline eventsData={transformEvents(jobData.events)} />
{/* <HorizontalTimeline eventsData={testData} /> */}
<div className="my-7">
<Separator />
</div>
Expand Down
18 changes: 14 additions & 4 deletions src/helpers/student/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand All @@ -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");
}
Expand Down

0 comments on commit 6fec724

Please sign in to comment.