From 3c08445dc64d3c7addb954a549e33327be7a4c95 Mon Sep 17 00:00:00 2001 From: Cipher Vance Date: Sat, 22 Nov 2025 22:57:59 -0600 Subject: [PATCH] more backend api work --- docker/nginx.conf | 1 - src/services/api.js | 2 +- src/stores/auth.js | 12 ++++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/docker/nginx.conf b/docker/nginx.conf index b79ebe5..f7d2461 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -53,7 +53,6 @@ server { return 204; } } - # SPA - route all requests to index.html location / { diff --git a/src/services/api.js b/src/services/api.js index b0bb75f..9586dd9 100644 --- a/src/services/api.js +++ b/src/services/api.js @@ -42,7 +42,7 @@ api.interceptors.response.use( // Use relative path in production, full URL in development const refreshUrl = process.env.NODE_ENV === 'production' - ? '/refresh-token' + ? '/api/refresh-token' : `${API_BASE_URL}/refresh-token` const { data } = await axios.post(refreshUrl, { diff --git a/src/stores/auth.js b/src/stores/auth.js index faeb27b..2028e57 100644 --- a/src/stores/auth.js +++ b/src/stores/auth.js @@ -16,7 +16,7 @@ export const useAuthStore = defineStore('auth', () => { error.value = null try { - const { data } = await api.post('/signup', { + const { data } = await api.post('/api/signup', { username, password, email, @@ -50,7 +50,7 @@ export const useAuthStore = defineStore('auth', () => { error.value = null try { - const { data } = await api.post('/login', { + const { data } = await api.post('/api/login', { username, password, }) @@ -92,7 +92,7 @@ export const useAuthStore = defineStore('auth', () => { error.value = null try { - const { data } = await api.post('/password-reset/request', { email }) + const { data } = await api.post('/api/password-reset/request', { email }) return data } catch (err) { error.value = err.response?.data?.error || 'Password reset request failed' @@ -107,7 +107,7 @@ export const useAuthStore = defineStore('auth', () => { error.value = null try { - const { data } = await api.post('/password-reset/confirm', { + const { data } = await api.post('/api/password-reset/confirm', { token, new_password: newPassword, }) @@ -125,7 +125,7 @@ export const useAuthStore = defineStore('auth', () => { error.value = null try { - const { data } = await api.get('/protected/profile') + const { data } = await api.get('/api/protected/profile') return data } catch (err) { error.value = err.response?.data?.error || 'Failed to fetch profile' @@ -140,7 +140,7 @@ export const useAuthStore = defineStore('auth', () => { error.value = null try { - const { data } = await api.put('/protected/profile', profileData) + const { data } = await api.put('/api/protected/profile', profileData) return data } catch (err) { error.value = err.response?.data?.error || 'Failed to update profile'