Updated the code to use the new desired levels
This commit is contained in:
@@ -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"});
|
||||
|
||||
Reference in New Issue
Block a user