From 04b9707272ca02f5a6aa7720318e1c5fd4e0bf3b Mon Sep 17 00:00:00 2001 From: Hornwitser Date: Sat, 31 May 2025 21:44:19 +0200 Subject: [PATCH] Move /api/account to /api/auth/account An account refers to the user the active session is logged in as. As such it doesn't make sense outside of the /auth API paths that deals with the current authenticated user. Move /api/account to /api/auth/account to reflect this. --- pages/account/settings.vue | 4 ++-- pages/login.vue | 4 ++-- server/api/{ => auth}/account.delete.ts | 0 server/api/{ => auth}/account.patch.ts | 0 server/api/{ => auth}/account.post.ts | 0 stores/account.ts | 2 +- 6 files changed, 5 insertions(+), 5 deletions(-) rename server/api/{ => auth}/account.delete.ts (100%) rename server/api/{ => auth}/account.patch.ts (100%) rename server/api/{ => auth}/account.post.ts (100%) diff --git a/pages/account/settings.vue b/pages/account/settings.vue index 1a560e2..04691d5 100644 --- a/pages/account/settings.vue +++ b/pages/account/settings.vue @@ -41,7 +41,7 @@ const timezone = ref(accountStore.timezone ?? ""); async function changeSettings() { try { - await $fetch("/api/account", { + await $fetch("/api/auth/account", { method: "patch", body: { timezone: timezone.value, @@ -55,7 +55,7 @@ async function changeSettings() { async function deleteAccount() { try { - await $fetch.raw("/api/account", { + await $fetch.raw("/api/auth/account", { method: "DELETE", }); await sessionStore.fetch(); diff --git a/pages/login.vue b/pages/login.vue index 651d12c..8f5e3be 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -56,7 +56,7 @@ async function logIn() { const createName = ref(""); async function createAccount() { try { - const res = await $fetch.raw("/api/account", { + const res = await $fetch.raw("/api/auth/account", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded", @@ -74,7 +74,7 @@ async function createAccount() { } async function createAnonymousAccount() { try { - const res = await $fetch.raw("/api/account", { + const res = await $fetch.raw("/api/auth/account", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded", diff --git a/server/api/account.delete.ts b/server/api/auth/account.delete.ts similarity index 100% rename from server/api/account.delete.ts rename to server/api/auth/account.delete.ts diff --git a/server/api/account.patch.ts b/server/api/auth/account.patch.ts similarity index 100% rename from server/api/account.patch.ts rename to server/api/auth/account.patch.ts diff --git a/server/api/account.post.ts b/server/api/auth/account.post.ts similarity index 100% rename from server/api/account.post.ts rename to server/api/auth/account.post.ts diff --git a/stores/account.ts b/stores/account.ts index a6f7147..4f47742 100644 --- a/stores/account.ts +++ b/stores/account.ts @@ -45,7 +45,7 @@ export const useAccountStore = defineStore("account", () => { newIds = newIds.filter(newId => !filterIds.has(newId)); } } - await $fetch("/api/account", { + await $fetch("/api/auth/account", { method: "PATCH", body: { interestedIds: newIds }, })