separate user from token

This commit is contained in:
Alex Holliday committed 2026-01-16 19:12:21 +00:00
1 parent 8747c38f40
commit af82dec2ad
6 files changed
+19 -28

No files matched your search

+16 -13
View File
@@ -10,21 +10,24 @@ const initialState = {
msg: null,
};
export const register = createAsyncThunk("auth/register", async (form, thunkApi) => {
try {
const res = await networkService.registerUser(form);
return res.data;
} catch (error) {
if (error.response.data) {
return thunkApi.rejectWithValue(error.response.data);
export const register = createAsyncThunk(
"auth/register",
async ({ user, token }, thunkApi) => {
try {
const res = await networkService.registerUser(user, token);
return res.data;
} catch (error) {
if (error.response.data) {
return thunkApi.rejectWithValue(error.response.data);
}
const payload = {
status: false,
msg: error.message ? error.message : "Unknown error",
};
return thunkApi.rejectWithValue(payload);
}
const payload = {
status: false,
msg: error.message ? error.message : "Unknown error",
};
return thunkApi.rejectWithValue(payload);
}
});
);
export const login = createAsyncThunk("auth/login", async (form, thunkApi) => {
try {