Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot fix/update admin panel fetch postings #77

Merged
merged 3 commits into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/app/admin-panel/home/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { useCallback } from 'react';
import Navbar from '@/components/ui/navbar';

const MAX_PAGES = 999;
const MAX_PAGES = Infinity;

// Define your component
export default function Home() {
Expand Down Expand Up @@ -50,6 +50,7 @@
let jobPostingsArray = [];

while (page <= MAX_PAGES) {
// while (true) is not allowed with eslint
const apiURL = `${JOB_POSTING_API_URL}?page_num=${page}&email=${user.email}`;
const response = await fetch(apiURL, {
method: 'GET',
Expand Down Expand Up @@ -79,6 +80,9 @@
console.error('Failed to fetch job postings:', response.statusText);
break;
}

//reverse the array to show the latest job postings first
jobPostingsArray = jobPostingsArray.reverse();
}

// Set the job postings array in state
Expand All @@ -92,7 +96,7 @@

useEffect(() => {
fetchUser();
}, []); // Fetch job postings when the component mounts

Check warning on line 99 in src/app/admin-panel/home/page.js

View workflow job for this annotation

GitHub Actions / format

React Hook useEffect has a missing dependency: 'fetchUser'. Either include it or remove the dependency array

useEffect(() => {
if (user) {
Expand Down
Loading