Chore: Migrate REST API - usersAutoComplete to Typescript (#3845)

This commit is contained in:
Reinaldo Neto 2022-03-07 12:32:51 -03:00 committed by GitHub
parent 9652692af5
commit 261b380818
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 6 deletions

View File

@ -20,10 +20,6 @@ const styles = StyleSheet.create({
padding: 16 padding: 16
} }
}); });
interface IUser {
username: string;
_id: string;
}
interface IParsedData { interface IParsedData {
label: string; label: string;
@ -47,7 +43,7 @@ const ForwardLivechatView = ({ navigation, route, theme }: IBaseScreen<ChatsStac
try { try {
const result = await RocketChat.getDepartments({ count: COUNT_DEPARTMENT, text, offset }); const result = await RocketChat.getDepartments({ count: COUNT_DEPARTMENT, text, offset });
if (result.success) { if (result.success) {
const parsedDepartments: IParsedData[] = result.departments.map(department => ({ const parsedDepartments = result.departments.map(department => ({
label: department.name, label: department.name,
value: department._id value: department._id
})); }));
@ -71,7 +67,7 @@ const ForwardLivechatView = ({ navigation, route, theme }: IBaseScreen<ChatsStac
term term
}); });
if (result.success) { if (result.success) {
const parsedUsers = result.items.map((user: IUser) => ({ label: user.username, value: user._id })); const parsedUsers = result.items.map(user => ({ label: user.username, value: user._id }));
if (!term) { if (!term) {
setUsers(parsedUsers); setUsers(parsedUsers);
} }