diff --git a/src/components/Diagnostic.tsx b/src/components/Diagnostic.tsx index a67159f5..d2ec222a 100644 --- a/src/components/Diagnostic.tsx +++ b/src/components/Diagnostic.tsx @@ -27,6 +27,7 @@ export default function Diagnostic({onFinish}: Props) { const [focus, setFocus] = useState<"academic" | "general">(); const [isInsert, setIsInsert] = useState(false); const [levels, setLevels] = useState({reading: 0, listening: 0, writing: 0, speaking: 0}); + const [desiredLevels, setDesiredLevels] = useState({reading: 9, listening: 9, writing: 9, speaking: 9}); const router = useRouter(); @@ -47,7 +48,7 @@ export default function Diagnostic({onFinish}: Props) { const updateUser = (callback: () => void) => { axios - .patch("/api/users/update", {focus, levels, isFirstLogin: false}) + .patch("/api/users/update", {focus, levels, desiredLevels, isFirstLogin: false}) .then(callback) .catch(() => { toast.error("Something went wrong, please try again later!", {toastId: "user-update-error"}); diff --git a/src/interfaces/user.ts b/src/interfaces/user.ts index 099166e2..f8a9cc91 100644 --- a/src/interfaces/user.ts +++ b/src/interfaces/user.ts @@ -9,6 +9,7 @@ export interface User { isFirstLogin: boolean; focus: "academic" | "general"; levels: {[key in Module]: number}; + desiredLevels: {[key in Module]: number}; type: Type; } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index dc3208d2..742f28aa 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -156,11 +156,18 @@ export default function Home() {