Chore: Migrate REST API - getListCannedResponse to Typescript (#3858)
This commit is contained in:
parent
e2612eb455
commit
9becdf564e
|
@ -609,7 +609,7 @@ class MessageBox extends Component<IMessageBoxProps, IMessageBoxState> {
|
|||
|
||||
getCannedResponses = debounce(async (text?: string) => {
|
||||
const res = await RocketChat.getListCannedResponse({ text });
|
||||
this.setState({ mentions: res?.cannedResponses || [], mentionLoading: false });
|
||||
this.setState({ mentions: res.success ? res.cannedResponses : [], mentionLoading: false });
|
||||
}, 500);
|
||||
|
||||
focus = () => {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { ICannedResponse } from '../../ICannedResponse';
|
||||
import { ILivechatAgent } from '../../ILivechatAgent';
|
||||
import { ILivechatDepartment } from '../../ILivechatDepartment';
|
||||
import { ILivechatDepartmentAgents } from '../../ILivechatDepartmentAgents';
|
||||
|
@ -190,4 +191,10 @@ export type OmnichannelEndpoints = {
|
|||
total: number;
|
||||
};
|
||||
};
|
||||
|
||||
'canned-responses': {
|
||||
GET: (params: PaginatedRequest<{ scope?: string; departmentId?: string; text?: string }>) => PaginatedResult<{
|
||||
cannedResponses: ICannedResponse[];
|
||||
}>;
|
||||
};
|
||||
};
|
||||
|
|
|
@ -405,7 +405,7 @@ export const getCustomFields = () =>
|
|||
// RC 2.2.0
|
||||
sdk.get('livechat/custom-fields');
|
||||
|
||||
export const getListCannedResponse = ({ scope = '', departmentId = '', offset = 0, count = 25, text = '' }): any => {
|
||||
export const getListCannedResponse = ({ scope = '', departmentId = '', offset = 0, count = 25, text = '' }) => {
|
||||
const params = {
|
||||
offset,
|
||||
count,
|
||||
|
@ -415,8 +415,6 @@ export const getListCannedResponse = ({ scope = '', departmentId = '', offset =
|
|||
};
|
||||
|
||||
// RC 3.17.0
|
||||
// TODO: missing definitions from server
|
||||
// @ts-ignore
|
||||
return sdk.get('canned-responses', params);
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue