diff --git a/src/components/Diagnostic.tsx b/src/components/Diagnostic.tsx index 6ea57cde..fe225045 100644 --- a/src/components/Diagnostic.tsx +++ b/src/components/Diagnostic.tsx @@ -45,19 +45,10 @@ export default function Diagnostic({onFinish}: Props) { }); }; - const updateUser = () => { + const updateUser = (callback: () => void) => { axios .post("/api/users/update", {focus, levels, isFirstLogin: false}) - .then(onFinish) - .catch(() => { - toast.error("Something went wrong, please try again later!", {toastId: "user-update-error"}); - }); - }; - - const onPerformDiagnosis = async () => { - axios - .post("/api/users/update", {focus, isFirstLogin: false}) - .then(selectExam) + .then(callback) .catch(() => { toast.error("Something went wrong, please try again later!", {toastId: "user-update-error"}); }); @@ -103,7 +94,7 @@ export default function Diagnostic({onFinish}: Props) { ))} -