get user by thunkApi instead of jwtDecode token
This commit is contained in:
1 parent
f2ae99768a
commit
e8c0a98a7b
4 files changed
+7
-11
No files matched your search
@@ -1,5 +1,4 @@
|
||||
import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
|
||||
import { jwtDecode } from "jwt-decode";
|
||||
import { networkService } from "../../main";
|
||||
const initialState = {
|
||||
isLoading: false,
|
||||
@@ -70,8 +69,8 @@ export const getInfrastructureMonitorById = createAsyncThunk(
|
||||
|
||||
export const getInfrastructureMonitorsByTeamId = createAsyncThunk(
|
||||
"infrastructureMonitors/getMonitorsByTeamId",
|
||||
async (token, thunkApi) => {
|
||||
const user = jwtDecode(token);
|
||||
async (_, thunkApi) => {
|
||||
const user = thunkApi.getState().auth.user;
|
||||
try {
|
||||
const res = await networkService.getMonitorsAndSummaryByTeamId({
|
||||
teamId: user.teamId,
|
||||
|
||||
Reference in new issue
Block a user