Skip to content

Commit

Permalink
Update operations.js
Browse files Browse the repository at this point in the history
  • Loading branch information
AnWhiteM committed Jun 12, 2024
1 parent 758816d commit 280f309
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/redux/auth/operations.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ export const register = createAsyncThunk(
async (userInfo, thunkAPI) => {
try {
axios.defaults.headers.secretkey = "QWERTY";
const response = await axios.post("/auth/register", userInfo);
setAuthHeader(response.data.token);
return response.data;
await axios.post("/auth/register", userInfo);
const logResponse = await axios.post("/auth/login", userInfo);
setAuthHeader(logResponse.data.token);
return logResponse.data;
} catch (error) {
return thunkAPI.rejectWithValue(error.message);
}
Expand Down

0 comments on commit 280f309

Please sign in to comment.