Skip to content

Commit

Permalink
Merge pull request #77 from Vero-Ventures/hot-fix/update-admin-panel-…
Browse files Browse the repository at this point in the history
…fetch-postings

Hot fix/update admin panel fetch postings
  • Loading branch information
ama-cantabile authored May 23, 2024
2 parents 41e64a5 + 6e5cf3c commit ee038aa
Showing 1 changed file with 5 additions and 1 deletion.
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 jobPostingService from './jobPostingService';
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 @@ export default function Home() {
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 @@ export default function Home() {
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 Down

0 comments on commit ee038aa

Please sign in to comment.