Skip to content

Commit 91c7d55

Browse files
committed
chore: updated auth slice
1 parent b80c832 commit 91c7d55

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/features/auth/authSlice.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ export const authSlice = createSlice({
149149
state.isLoading = false;
150150
state.isSuccess = true;
151151
var userDict = action.payload.data
152-
userDict['id'] = jwt_decode(action.payload.data.access)['user_id']
152+
var jwt_data = jwt_decode(action.payload.data.access)
153+
if (jwt_data?.user_id) userDict['id'] = jwt_data['user_id']
154+
if (jwt_data?.userId) userDict['id'] = jwt_data['userId']
155+
153156
state.user = userDict;
154157
})
155158
.addCase(login.rejected, (state, action) => {

0 commit comments

Comments
 (0)