Skip to content

Commit

Permalink
fixed linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj-Ram committed Jan 21, 2024
1 parent 69b7060 commit fa72de4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
5 changes: 1 addition & 4 deletions packages/frontend/components/Plan/DeleteYearModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,14 @@ import {
ModalOverlay,
useDisclosure,
} from "@chakra-ui/react";
import { API } from "@graduate/api-client";
import { useRouter } from "next/router";
import { Dispatch, SetStateAction, useContext } from "react";
import { Dispatch, SetStateAction } from "react";
import { mutate } from "swr";
import {
USE_STUDENT_WITH_PLANS_SWR_KEY,
useStudentWithPlans,
} from "../../hooks";
import { handleApiClientError, toast } from "../../utils";
import { IsGuestContext } from "../../pages/_app";
import { GraduateToolTip } from "../GraduateTooltip";

interface DeleteYearModalProps {
Expand All @@ -34,7 +32,6 @@ export const DeleteYearModal: React.FC<DeleteYearModalProps> = ({
}) => {
const router = useRouter();
const { onOpen, onClose, isOpen } = useDisclosure();
const { isGuest } = useContext(IsGuestContext);
const { student } = useStudentWithPlans();

if (!student) {
Expand Down
27 changes: 13 additions & 14 deletions packages/frontend/hooks/useRedirectIfLoggedIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@ export const useRedirectIfLoggedIn = () => {
const [renderSpinner, setRenderSpinner] = useState(false);
const { setIsGuest } = useContext(IsGuestContext);

const loginWithCookie = async () => {
setRenderSpinner(true);
try {
await API.student.getMe();
setIsGuest(false);
router.push("/home");
} catch (err) {
const error = err as AxiosError;
logger.error(error);
setRenderSpinner(false);
}
};

useEffect(() => {
const loginWithCookie = async () => {
setRenderSpinner(true);
try {
await API.student.getMe();
setIsGuest(false);
router.push("/home");
} catch (err) {
const error = err as AxiosError;
logger.error(error);
setRenderSpinner(false);
}
};
loginWithCookie();
}, []);
}, [setIsGuest]);

return renderSpinner;
};

0 comments on commit fa72de4

Please sign in to comment.