【发布时间】:2021-12-21 15:29:32
【问题描述】:
我想在这个 createApi 函数中使用 current redux store data 来更改 postBody 变量来查询 body。
我的意思是,如果可能的话,我想从 store 中获取一个 redux 节点,并将数据与 postBody 合并。
export const loginIdentityApi = createApi({
reducerPath: 'loginIdentity',
baseQuery,
tagTypes: ['Login'],
endpoints: (build) => ({
postLogin: build.mutation<TApiResponse, TPostBody>({
query: (postBody: TPostBody) => ({
url: urlPrep(signin, {
updateCookies: true,
}),
method: 'POST',
body: postBody,
}),
transformResponse: (response: TApiResponse) => {
return response
},
invalidatesTags: ['Login'],
}),
}),
})
【问题讨论】:
标签: typescript redux-toolkit rtk-query