From 004f4ab0eeb5c112621e1900d45b829544f94325 Mon Sep 17 00:00:00 2001 From: Reinaldo Neto <47038980+reinaldonetof@users.noreply.github.com> Date: Mon, 7 Mar 2022 23:30:13 -0300 Subject: [PATCH] Chore: Migrate REST API - getTagsList to Typescript (#3854) --- app/definitions/ITagsOmnichannel.ts | 5 ----- app/lib/rocketchat/services/restApi.ts | 8 +++++++- app/views/LivechatEditView.tsx | 3 +-- 3 files changed, 8 insertions(+), 8 deletions(-) delete mode 100644 app/definitions/ITagsOmnichannel.ts diff --git a/app/definitions/ITagsOmnichannel.ts b/app/definitions/ITagsOmnichannel.ts deleted file mode 100644 index d0bb2c9b5..000000000 --- a/app/definitions/ITagsOmnichannel.ts +++ /dev/null @@ -1,5 +0,0 @@ -export interface ITagsOmnichannel { - _id: string; - name: string; - departments: string[]; -} diff --git a/app/lib/rocketchat/services/restApi.ts b/app/lib/rocketchat/services/restApi.ts index 0175a9d12..2e9a39be8 100644 --- a/app/lib/rocketchat/services/restApi.ts +++ b/app/lib/rocketchat/services/restApi.ts @@ -387,7 +387,13 @@ export const getRoutingConfig = (): Promise<{ // RC 2.0.0 sdk.methodCallWrapper('livechat:getRoutingConfig'); -export const getTagsList = () => +export const getTagsList = (): Promise< + { + _id: string; + name: string; + departments: string[]; + }[] +> => // RC 2.0.0 sdk.methodCallWrapper('livechat:getTagsList'); diff --git a/app/views/LivechatEditView.tsx b/app/views/LivechatEditView.tsx index 842dfc768..f590463c9 100644 --- a/app/views/LivechatEditView.tsx +++ b/app/views/LivechatEditView.tsx @@ -19,7 +19,6 @@ import Button from '../containers/Button'; import SafeAreaView from '../containers/SafeAreaView'; import { MultiSelect } from '../containers/UIKit/MultiSelect'; import { ILivechatVisitor } from '../definitions/ILivechatVisitor'; -import { ITagsOmnichannel } from '../definitions/ITagsOmnichannel'; import { IApplicationState, ISubscription } from '../definitions'; import { ChatsStackParamList } from '../stacks/types'; import sharedStyles from './Styles'; @@ -142,7 +141,7 @@ const LivechatEditView = ({ }, [availableUserTags]); const getTagsList = async (agentDepartments: string[]) => { - const tags: ITagsOmnichannel[] = await RocketChat.getTagsList(); + const tags = await RocketChat.getTagsList(); const isAdmin = ['admin', 'livechat-manager'].find(role => user.roles.includes(role)); const availableTags = tags .filter(({ departments }) => isAdmin || departments.length === 0 || departments.some(i => agentDepartments.indexOf(i) > -1))