Chore: Migrate REST API - getTeamListRoom to TS (#3840)
* add: `teams.listRooms` types * add: `PaginatedResult<T>` to `teams.ts`
This commit is contained in:
parent
b2bd71e83e
commit
15f573a703
|
@ -1,17 +1,13 @@
|
|||
import { IServerRoom } from '../../IRoom';
|
||||
import { IServerTeamUpdateRoom, ITeam, TEAM_TYPE } from '../../ITeam';
|
||||
import { PaginatedResult } from '../helpers/PaginatedResult';
|
||||
|
||||
export type TeamsEndpoints = {
|
||||
'teams.removeRoom': {
|
||||
POST: (params: { roomId: string; teamId: string }) => { room: IServerRoom };
|
||||
};
|
||||
'teams.listRoomsOfUser': {
|
||||
GET: (params: { teamId: string; userId: string }) => {
|
||||
rooms: IServerRoom[];
|
||||
total: number;
|
||||
count: number;
|
||||
offset: number;
|
||||
};
|
||||
GET: (params: { teamId: string; userId: string }) => PaginatedResult<{ rooms: IServerRoom[] }>;
|
||||
};
|
||||
'teams.updateRoom': {
|
||||
POST: (params: { roomId: string; isDefault: boolean }) => { room: IServerTeamUpdateRoom };
|
||||
|
@ -33,4 +29,13 @@ export type TeamsEndpoints = {
|
|||
room: { readOnly: boolean; extraData: { broadcast: boolean; encrypted: boolean } };
|
||||
}) => { team: ITeam };
|
||||
};
|
||||
'teams.listRooms': {
|
||||
GET: (params: {
|
||||
teamId: string;
|
||||
count: number;
|
||||
offset: number;
|
||||
type: string;
|
||||
filter?: any;
|
||||
}) => PaginatedResult<{ rooms: IServerTeamUpdateRoom[] }>;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -319,7 +319,7 @@ export const getTeamListRoom = ({
|
|||
offset: number;
|
||||
type: string;
|
||||
filter: any;
|
||||
}): any => {
|
||||
}) => {
|
||||
const params: any = {
|
||||
teamId,
|
||||
count,
|
||||
|
@ -331,8 +331,6 @@ export const getTeamListRoom = ({
|
|||
params.filter = filter;
|
||||
}
|
||||
// RC 3.13.0
|
||||
// TODO: missing definitions from server
|
||||
// @ts-ignore
|
||||
return sdk.get('teams.listRooms', params);
|
||||
};
|
||||
|
||||
|
|
|
@ -187,8 +187,10 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
|
|||
} as ITeamChannelsViewState;
|
||||
|
||||
if (isSearching) {
|
||||
// @ts-ignore
|
||||
newState.search = [...search, ...result.rooms];
|
||||
} else {
|
||||
// @ts-ignore
|
||||
newState.data = [...data, ...result.rooms];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue