Updated the code to use the new desired levels

This commit is contained in:
Tiago Ribeiro
2023-06-12 14:05:48 +01:00
parent 6fe8a678ea
commit e864e16064
3 changed files with 39 additions and 9 deletions

View File

@@ -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"});