feat: add server common API
This commit is contained in:
@@ -18,7 +18,8 @@ import {
|
||||
RenewLicense,
|
||||
RenewLicenseResponse,
|
||||
AgoraTokenResponse,
|
||||
AgoraVoicingListResponse
|
||||
AgoraVoicingListResponse,
|
||||
SystemCommon
|
||||
} from "../../types/server";
|
||||
import { Channel } from "../../types/channel";
|
||||
import { ContentTypeKey } from "../../types/message";
|
||||
@@ -146,6 +147,26 @@ export const serverApi = createApi({
|
||||
}
|
||||
}
|
||||
}),
|
||||
getSystemCommon: builder.query<SystemCommon, void>({
|
||||
query: () => ({ url: `admin/system/common` })
|
||||
}),
|
||||
updateSystemCommon: builder.mutation<void, Partial<SystemCommon>>({
|
||||
query: (data) => ({
|
||||
url: `admin/system/common`,
|
||||
method: "PUT",
|
||||
body: data
|
||||
}),
|
||||
async onQueryStarted(data, { dispatch, queryFulfilled }) {
|
||||
try {
|
||||
await queryFulfilled;
|
||||
dispatch(
|
||||
updateInfo(data)
|
||||
);
|
||||
} catch {
|
||||
console.error("update server common error");
|
||||
}
|
||||
}
|
||||
}),
|
||||
getSMTPConfig: builder.query<SMTPConfig, void>({
|
||||
query: () => ({ url: `admin/smtp/config` })
|
||||
}),
|
||||
@@ -360,5 +381,7 @@ export const {
|
||||
useGetFrontendUrlQuery,
|
||||
useLazyGetAgoraTokenQuery,
|
||||
useGetAgoraConfigQuery,
|
||||
useGetAgoraVoicingListQuery
|
||||
useGetAgoraVoicingListQuery,
|
||||
useUpdateSystemCommonMutation,
|
||||
useGetSystemCommonQuery
|
||||
} = serverApi;
|
||||
|
||||
Reference in New Issue
Block a user