diff --git a/src/components/Diagnostic.tsx b/src/components/Diagnostic.tsx
index 434f1159..b5f617b3 100644
--- a/src/components/Diagnostic.tsx
+++ b/src/components/Diagnostic.tsx
@@ -39,12 +39,7 @@ export default function Diagnostic({onFinish}: Props) {
const isNextDisabled = () => {
if (!focus) return true;
- if (levels.reading === -1) return true;
- if (levels.listening === -1) return true;
- if (levels.writing === -1) return true;
- if (levels.speaking === -1) return true;
-
- return false;
+ return Object.values(levels).includes(-1);
};
const selectExam = () => {
@@ -61,7 +56,12 @@ export default function Diagnostic({onFinish}: Props) {
const updateUser = (callback: () => void) => {
axios
- .patch("/api/users/update", {focus, levels, desiredLevels, isFirstLogin: false})
+ .patch("/api/users/update", {
+ focus,
+ levels: Object.values(levels).includes(-1) ? {reading: -1, listening: -1, writing: -1, speaking: -1} : levels,
+ desiredLevels,
+ isFirstLogin: false,
+ })
.then(callback)
.catch(() => {
toast.error("Something went wrong, please try again later!", {toastId: "user-update-error"});
@@ -108,13 +108,17 @@ export default function Diagnostic({onFinish}: Props) {