Chore: Migrate REST API - getChannelInfo to TS (#3839)
* add: type for REST API `channels.info` * add: `ts-ignore` to `RoomActionsView`
This commit is contained in:
parent
fe33a4a6b0
commit
d7c46a27d0
|
@ -52,6 +52,9 @@ export type ChannelsEndpoints = {
|
|||
'channels.convertToTeam': {
|
||||
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
||||
};
|
||||
'channels.info': {
|
||||
GET: (params: { roomId: string }) => { channel: IServerRoomItem };
|
||||
};
|
||||
'channels.counters': {
|
||||
GET: (params: { roomId: string }) => {
|
||||
joined: boolean;
|
||||
|
|
|
@ -285,10 +285,8 @@ export const getRoomCounters = (
|
|||
// RC 0.65.0
|
||||
sdk.get(`${roomTypeToApiType(t)}.counters`, { roomId });
|
||||
|
||||
export const getChannelInfo = (roomId: string): any =>
|
||||
export const getChannelInfo = (roomId: string) =>
|
||||
// RC 0.48.0
|
||||
// TODO: missing definitions from server
|
||||
// @ts-ignore
|
||||
sdk.get('channels.info', { roomId });
|
||||
|
||||
export const getUserPreferences = (userId: string): any =>
|
||||
|
|
|
@ -106,7 +106,7 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
|||
this.t = props.route.params?.t;
|
||||
this.joined = props.route.params?.joined;
|
||||
this.state = {
|
||||
room: room || ({ rid: this.rid, t: this.t } as any),
|
||||
room: room || { rid: this.rid, t: this.t },
|
||||
membersCount: 0,
|
||||
member: member || {},
|
||||
joined: !!room,
|
||||
|
@ -144,6 +144,7 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
|||
try {
|
||||
const result = await RocketChat.getChannelInfo(room.rid);
|
||||
if (result.success) {
|
||||
// @ts-ignore
|
||||
this.setState({ room: { ...result.channel, rid: result.channel._id } });
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
Loading…
Reference in New Issue