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 { IServerRoom } from '../../IRoom';
|
||||||
import { IServerTeamUpdateRoom, ITeam, TEAM_TYPE } from '../../ITeam';
|
import { IServerTeamUpdateRoom, ITeam, TEAM_TYPE } from '../../ITeam';
|
||||||
|
import { PaginatedResult } from '../helpers/PaginatedResult';
|
||||||
|
|
||||||
export type TeamsEndpoints = {
|
export type TeamsEndpoints = {
|
||||||
'teams.removeRoom': {
|
'teams.removeRoom': {
|
||||||
POST: (params: { roomId: string; teamId: string }) => { room: IServerRoom };
|
POST: (params: { roomId: string; teamId: string }) => { room: IServerRoom };
|
||||||
};
|
};
|
||||||
'teams.listRoomsOfUser': {
|
'teams.listRoomsOfUser': {
|
||||||
GET: (params: { teamId: string; userId: string }) => {
|
GET: (params: { teamId: string; userId: string }) => PaginatedResult<{ rooms: IServerRoom[] }>;
|
||||||
rooms: IServerRoom[];
|
|
||||||
total: number;
|
|
||||||
count: number;
|
|
||||||
offset: number;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
'teams.updateRoom': {
|
'teams.updateRoom': {
|
||||||
POST: (params: { roomId: string; isDefault: boolean }) => { room: IServerTeamUpdateRoom };
|
POST: (params: { roomId: string; isDefault: boolean }) => { room: IServerTeamUpdateRoom };
|
||||||
|
@ -33,4 +29,13 @@ export type TeamsEndpoints = {
|
||||||
room: { readOnly: boolean; extraData: { broadcast: boolean; encrypted: boolean } };
|
room: { readOnly: boolean; extraData: { broadcast: boolean; encrypted: boolean } };
|
||||||
}) => { team: ITeam };
|
}) => { 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;
|
offset: number;
|
||||||
type: string;
|
type: string;
|
||||||
filter: any;
|
filter: any;
|
||||||
}): any => {
|
}) => {
|
||||||
const params: any = {
|
const params: any = {
|
||||||
teamId,
|
teamId,
|
||||||
count,
|
count,
|
||||||
|
@ -331,8 +331,6 @@ export const getTeamListRoom = ({
|
||||||
params.filter = filter;
|
params.filter = filter;
|
||||||
}
|
}
|
||||||
// RC 3.13.0
|
// RC 3.13.0
|
||||||
// TODO: missing definitions from server
|
|
||||||
// @ts-ignore
|
|
||||||
return sdk.get('teams.listRooms', params);
|
return sdk.get('teams.listRooms', params);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -187,8 +187,10 @@ class TeamChannelsView extends React.Component<ITeamChannelsViewProps, ITeamChan
|
||||||
} as ITeamChannelsViewState;
|
} as ITeamChannelsViewState;
|
||||||
|
|
||||||
if (isSearching) {
|
if (isSearching) {
|
||||||
|
// @ts-ignore
|
||||||
newState.search = [...search, ...result.rooms];
|
newState.search = [...search, ...result.rooms];
|
||||||
} else {
|
} else {
|
||||||
|
// @ts-ignore
|
||||||
newState.data = [...data, ...result.rooms];
|
newState.data = [...data, ...result.rooms];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue