Chore: Migrate REST API - getListCannedResponse to Typescript (#3858)

This commit is contained in:
Reinaldo Neto 2022-03-08 11:30:45 -03:00 committed by GitHub
parent e2612eb455
commit 9becdf564e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 4 deletions

View File

@ -609,7 +609,7 @@ class MessageBox extends Component<IMessageBoxProps, IMessageBoxState> {
getCannedResponses = debounce(async (text?: string) => { getCannedResponses = debounce(async (text?: string) => {
const res = await RocketChat.getListCannedResponse({ text }); const res = await RocketChat.getListCannedResponse({ text });
this.setState({ mentions: res?.cannedResponses || [], mentionLoading: false }); this.setState({ mentions: res.success ? res.cannedResponses : [], mentionLoading: false });
}, 500); }, 500);
focus = () => { focus = () => {

View File

@ -1,3 +1,4 @@
import { ICannedResponse } from '../../ICannedResponse';
import { ILivechatAgent } from '../../ILivechatAgent'; import { ILivechatAgent } from '../../ILivechatAgent';
import { ILivechatDepartment } from '../../ILivechatDepartment'; import { ILivechatDepartment } from '../../ILivechatDepartment';
import { ILivechatDepartmentAgents } from '../../ILivechatDepartmentAgents'; import { ILivechatDepartmentAgents } from '../../ILivechatDepartmentAgents';
@ -190,4 +191,10 @@ export type OmnichannelEndpoints = {
total: number; total: number;
}; };
}; };
'canned-responses': {
GET: (params: PaginatedRequest<{ scope?: string; departmentId?: string; text?: string }>) => PaginatedResult<{
cannedResponses: ICannedResponse[];
}>;
};
}; };

View File

@ -405,7 +405,7 @@ export const getCustomFields = () =>
// RC 2.2.0 // RC 2.2.0
sdk.get('livechat/custom-fields'); 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 = { const params = {
offset, offset,
count, count,
@ -415,8 +415,6 @@ export const getListCannedResponse = ({ scope = '', departmentId = '', offset =
}; };
// RC 3.17.0 // RC 3.17.0
// TODO: missing definitions from server
// @ts-ignore
return sdk.get('canned-responses', params); return sdk.get('canned-responses', params);
}; };