feat: DM voice (draft)

This commit is contained in:
Tristan Yang
2023-05-09 21:35:22 +08:00
parent 6055a2d1e2
commit 118f802e86
9 changed files with 411 additions and 161 deletions
+15 -3
View File
@@ -19,7 +19,8 @@ import {
RenewLicenseResponse,
AgoraTokenResponse,
AgoraVoicingListResponse,
SystemCommon
SystemCommon,
AgoraChannelUsersResponse
} from "../../types/server";
import { Channel } from "../../types/channel";
import { ContentTypeKey } from "../../types/message";
@@ -130,7 +131,8 @@ export const serverApi = createApi({
return {
id: +id,
context,
memberCount: count
memberCount: count,
channelName: data.channel_name
};
});
dispatch(upsertVoiceList(arr));
@@ -140,6 +142,15 @@ export const serverApi = createApi({
}
}
}),
getAgoraUsersByChannel: builder.query<number[], string>({
query: (channel_name) => ({ url: `/admin/agora/channel/user/${channel_name}/false` }),
transformResponse: (resp: AgoraChannelUsersResponse) => {
if (resp.success && resp.data.channel_exist) {
return resp.data.users ?? [];
}
return [];
}
}),
updateAgoraConfig: builder.mutation<void, AgoraConfig>({
query: (data) => ({
url: `/admin/agora/config`,
@@ -405,5 +416,6 @@ export const {
useUpdateSystemCommonMutation,
useLazyGetSystemCommonQuery,
useGetSystemCommonQuery,
useGenerateAgoraTokenMutation
useGenerateAgoraTokenMutation,
useLazyGetAgoraUsersByChannelQuery
} = serverApi;