From 12b7819791df0111247bf06435aeb994d4e6bcb4 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 21 Jul 2025 11:05:10 -0700 Subject: [PATCH] remove user ID param from rotues --- client/src/Features/Auth/authSlice.js | 6 +----- client/src/Utils/NetworkService.js | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/client/src/Features/Auth/authSlice.js b/client/src/Features/Auth/authSlice.js index 2fde49202..5ee31944a 100644 --- a/client/src/Features/Auth/authSlice.js +++ b/client/src/Features/Auth/authSlice.js @@ -44,7 +44,6 @@ export const login = createAsyncThunk("auth/login", async (form, thunkApi) => { export const update = createAsyncThunk("auth/update", async (data, thunkApi) => { const { localData: form } = data; - const user = thunkApi.getState().auth.user; try { const fd = new FormData(); form.firstName && fd.append("firstName", form.firstName); @@ -60,7 +59,6 @@ export const update = createAsyncThunk("auth/update", async (data, thunkApi) => form.deleteProfileImage && fd.append("deleteProfileImage", form.deleteProfileImage); const res = await networkService.updateUser({ - userId: user._id, form: fd, }); return res.data; @@ -77,10 +75,8 @@ export const update = createAsyncThunk("auth/update", async (data, thunkApi) => }); export const deleteUser = createAsyncThunk("auth/delete", async (_, thunkApi) => { - const user = thunkApi.getState().auth.user; - try { - const res = await networkService.deleteUser({ userId: user._id }); + const res = await networkService.deleteUser(); return res.data; } catch (error) { if (error.response && error.response.data) { diff --git a/client/src/Utils/NetworkService.js b/client/src/Utils/NetworkService.js index 895d90d30..54bb239a4 100644 --- a/client/src/Utils/NetworkService.js +++ b/client/src/Utils/NetworkService.js @@ -393,7 +393,7 @@ class NetworkService { * */ async updateUser(config) { - return this.axiosInstance.put(`/auth/user/${config.userId}`, config.form); + return this.axiosInstance.put(`/auth/user`, config.form); } /** @@ -406,8 +406,8 @@ class NetworkService { * @param {string} config.userId - The ID of the user to be deleted. * **/ - async deleteUser(config) { - return this.axiosInstance.delete(`/auth/user/${config.userId}`); + async deleteUser() { + return this.axiosInstance.delete(`/auth/user`); } /**