mirror of
https://github.com/AmanTahiliani/PeerNotes.git
synced 2026-08-07 11:55:12 -04:00
fix fetching on undefined session
This commit is contained in:
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
import '../styles/MainScreenWrapper.css';
|
import '../styles/MainScreenWrapper.css';
|
||||||
import { getAuthHeaders } from '../utils/getAuthHeaders';
|
import { getAuthHeaders } from '../utils/getAuthHeaders';
|
||||||
import { Professor, Course, Topic, Semester } from "../types/types";
|
import { Professor, Course, Topic, Semester } from "../types/types";
|
||||||
|
import { getSessionCookie } from '../contexts/session';
|
||||||
|
|
||||||
interface Filters extends Record<string, string> {
|
interface Filters extends Record<string, string> {
|
||||||
professor: string;
|
professor: string;
|
||||||
@@ -23,6 +24,9 @@ const MainSearch: React.FC = () => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (!getSessionCookie()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Fetch professors
|
// Fetch professors
|
||||||
fetchProfessors();
|
fetchProfessors();
|
||||||
// Fetch courses
|
// Fetch courses
|
||||||
|
|||||||
Reference in New Issue
Block a user