mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-24 02:29:35 -06:00
remove user ID param from rotues
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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`);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user