Browse Source

fix profile button to enable/disable 2fa

master
nicolas-arnaud 2 years ago
parent
commit
34d774e28b
  1. 4
      front/volume/src/components/Profile.svelte

4
front/volume/src/components/Profile.svelte

@ -35,6 +35,7 @@
async function handle2fa(event: Event) { async function handle2fa(event: Event) {
event.preventDefault(); event.preventDefault();
user.twoFA = !user.twoFA;
let response = await fetch(API_URL, { let response = await fetch(API_URL, {
headers: { "content-type": "application/json" }, headers: { "content-type": "application/json" },
method: "POST", method: "POST",
@ -42,8 +43,7 @@
credentials: "include", credentials: "include",
}); });
if (response.ok) { if (response.ok) {
alert("Succefully " + (user.twoFA ? "disabled" : "enabled") + " 2FA"); alert("Succefully " + (user.twoFA ? "enabled" : "disabled") + " 2FA");
user.twoFA = !user.twoFA;
} }
} }
</script> </script>

Loading…
Cancel
Save