Updated the demographic input to work more as expected
This commit is contained in:
@@ -1,30 +1,19 @@
|
||||
/* eslint-disable @next/next/no-img-element */
|
||||
import Head from "next/head";
|
||||
import Navbar from "@/components/Navbar";
|
||||
import {BsFileEarmarkText, BsPencil, BsStar, BsBook, BsHeadphones, BsPen, BsMegaphone, BsArrowRepeat} from "react-icons/bs";
|
||||
import {withIronSessionSsr} from "iron-session/next";
|
||||
import {sessionOptions} from "@/lib/session";
|
||||
import {ChangeEvent, useEffect, useRef, useState} from "react";
|
||||
import useStats from "@/hooks/useStats";
|
||||
import {averageScore, totalExams} from "@/utils/stats";
|
||||
import useUser from "@/hooks/useUser";
|
||||
import Sidebar from "@/components/Sidebar";
|
||||
import Diagnostic from "@/components/Diagnostic";
|
||||
import {toast, ToastContainer} from "react-toastify";
|
||||
import {capitalize} from "lodash";
|
||||
import {Module} from "@/interfaces";
|
||||
import ProgressBar from "@/components/Low/ProgressBar";
|
||||
import Layout from "@/components/High/Layout";
|
||||
import {calculateAverageLevel} from "@/utils/score";
|
||||
import Input from "@/components/Low/Input";
|
||||
import Button from "@/components/Low/Button";
|
||||
import {useRouter} from "next/router";
|
||||
import Link from "next/link";
|
||||
import axios from "axios";
|
||||
import {ErrorMessage} from "@/constants/errors";
|
||||
import {RadioGroup} from "@headlessui/react";
|
||||
import clsx from "clsx";
|
||||
import {EmploymentStatus, EMPLOYMENT_STATUS, Gender} from "@/interfaces/user";
|
||||
import {EmploymentStatus, EMPLOYMENT_STATUS, Gender, User} from "@/interfaces/user";
|
||||
import countryCodes from "country-codes-list";
|
||||
|
||||
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
@@ -61,7 +50,6 @@ export default function Home() {
|
||||
const [employment, setEmployment] = useState<EmploymentStatus>();
|
||||
|
||||
const profilePictureInput = useRef(null);
|
||||
const router = useRouter();
|
||||
|
||||
const {user, mutateUser} = useUser({redirectTo: "/login"});
|
||||
|
||||
@@ -129,7 +117,7 @@ export default function Home() {
|
||||
});
|
||||
if (request.status === 200) {
|
||||
toast.success("Your profile has been updated!");
|
||||
mutateUser();
|
||||
mutateUser((request.data as {user: User}).user);
|
||||
setIsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user