А
Size: a a a
А
СТ
const dynamicBaseQuery: BaseQueryFn<string | FetchArgs,
unknown,
FetchBaseQueryError> = async (args, WebApi, extraOptions) => {
const baseUrl = (WebApi.getState() as any).configuration.baseUrl;
const rawBaseQuery = fetchBaseQuery({ baseUrl });
return rawBaseQuery(args, WebApi, extraOptions);
};
export const WebApi = createApi({
reducerPath: 'API',
baseQuery: dynamicBaseQuery,
endpoints: () => ({}),
});
А
СТ
А
А
СТ
А
А
СТ
А
DN
const usersSlice = createSlice({
name: 'users',
initialState: { entities: [], loading: 'idle' },
reducers: {
// standard reducer logic, with auto-generated action types per reducer
},
extraReducers: (builder) => {
// Add reducers for additional action types here, and handle loading state as needed
builder.addCase(fetchUserById.fulfilled, (state, action) => {
// Add user to the state array
state.entities.push(action.payload)
})
},
})IM
IM
IM
ИЕ
IM