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': {
|
'channels.convertToTeam': {
|
||||||
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
POST: (params: { channelId: string; channelName: string }) => { team: ITeam };
|
||||||
};
|
};
|
||||||
|
'channels.info': {
|
||||||
|
GET: (params: { roomId: string }) => { channel: IServerRoomItem };
|
||||||
|
};
|
||||||
'channels.counters': {
|
'channels.counters': {
|
||||||
GET: (params: { roomId: string }) => {
|
GET: (params: { roomId: string }) => {
|
||||||
joined: boolean;
|
joined: boolean;
|
||||||
|
|
|
@ -285,10 +285,8 @@ export const getRoomCounters = (
|
||||||
// RC 0.65.0
|
// RC 0.65.0
|
||||||
sdk.get(`${roomTypeToApiType(t)}.counters`, { roomId });
|
sdk.get(`${roomTypeToApiType(t)}.counters`, { roomId });
|
||||||
|
|
||||||
export const getChannelInfo = (roomId: string): any =>
|
export const getChannelInfo = (roomId: string) =>
|
||||||
// RC 0.48.0
|
// RC 0.48.0
|
||||||
// TODO: missing definitions from server
|
|
||||||
// @ts-ignore
|
|
||||||
sdk.get('channels.info', { roomId });
|
sdk.get('channels.info', { roomId });
|
||||||
|
|
||||||
export const getUserPreferences = (userId: string): any =>
|
export const getUserPreferences = (userId: string): any =>
|
||||||
|
|
|
@ -106,7 +106,7 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
||||||
this.t = props.route.params?.t;
|
this.t = props.route.params?.t;
|
||||||
this.joined = props.route.params?.joined;
|
this.joined = props.route.params?.joined;
|
||||||
this.state = {
|
this.state = {
|
||||||
room: room || ({ rid: this.rid, t: this.t } as any),
|
room: room || { rid: this.rid, t: this.t },
|
||||||
membersCount: 0,
|
membersCount: 0,
|
||||||
member: member || {},
|
member: member || {},
|
||||||
joined: !!room,
|
joined: !!room,
|
||||||
|
@ -144,6 +144,7 @@ class RoomActionsView extends React.Component<IRoomActionsViewProps, IRoomAction
|
||||||
try {
|
try {
|
||||||
const result = await RocketChat.getChannelInfo(room.rid);
|
const result = await RocketChat.getChannelInfo(room.rid);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
|
// @ts-ignore
|
||||||
this.setState({ room: { ...result.channel, rid: result.channel._id } });
|
this.setState({ room: { ...result.channel, rid: result.channel._id } });
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue