Chore: Migrate REST API - getTagsList to Typescript (#3854)
This commit is contained in:
parent
8a01552b4b
commit
004f4ab0ee
|
@ -1,5 +0,0 @@
|
|||
export interface ITagsOmnichannel {
|
||||
_id: string;
|
||||
name: string;
|
||||
departments: string[];
|
||||
}
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue