diff --git a/app/pages/settings/general.vue b/app/pages/settings/general.vue index bce2460..6352964 100644 --- a/app/pages/settings/general.vue +++ b/app/pages/settings/general.vue @@ -6,6 +6,7 @@ layout: "settings", middleware: ["login-required"] }) + const toast = useToast() const { data: user_data, refresh: userRefresh } = useFetch("/me"); const loading_btn = ref(false) @@ -20,14 +21,30 @@ async function submitChanges(event: FormSubmitEvent) { loading_btn.value = true - await $fetch("/settings/edit_user", { + await fetch("/settings/edit_user", { method: "POST", - body: { + body: JSON.stringify({ first_name: user_data.value.first_name, last_name: user_data.value.last_name, email: user_data.value.email + }) + }).then(async (response) => { + const body = await response.json() + if (response.ok) { + toast.add({ + title: "Done!", + description: "It's changed!", + color: "success" + }) } - }) + else { + toast.add({ + title: 'Error', + description : body.statusMessage || body.message || 'Something went wrong', + color: 'error' + }) + } + }) loading_btn.value = false } diff --git a/app/pages/settings/security.vue b/app/pages/settings/security.vue index 3acef61..8c24f9c 100644 --- a/app/pages/settings/security.vue +++ b/app/pages/settings/security.vue @@ -7,6 +7,7 @@ middleware: ["login-required"] }) const loading_btn = ref(false) + const toast = useToast() const schema = z.object({ @@ -30,11 +31,38 @@ async function submitChanges(event: FormSubmitEvent) { loading_btn.value = true - await $fetch("/settings/changepw", { - method: "POST", - body: pw_fields.value + try { + fetch("/settings/changepw", { + method: "POST", + body: JSON.stringify(pw_fields.value) + }).then(async (response) => { + const body = await response.json() + if (response.ok) { + toast.add({ + title: "Done!", + description: "It's changed!", + color: "success" + }) + } + else { + toast.add({ + title: 'Error', + description : body.statusMessage || body.message || 'Something went wrong', + color: 'error' + }) + } }) + } + catch(err:any) { + toast.add({ + title: 'Error', + description: err?.data?.statusMessage || err.message || 'Something went wrong', + color: 'error' + }) + } loading_btn.value = false + + } diff --git a/server/py/.vscode/launch.json b/server/py/.vscode/launch.json new file mode 100644 index 0000000..33ae04b --- /dev/null +++ b/server/py/.vscode/launch.json @@ -0,0 +1,9 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + + ] +} diff --git a/server/py/.vscode/settings.json b/server/py/.vscode/settings.json new file mode 100644 index 0000000..7e68766 --- /dev/null +++ b/server/py/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python-envs.pythonProjects": [] +} \ No newline at end of file