Chore: Migrate REST API - setUserStatus to Typescript (#3828)

* chore: add rest api return

* chore: add rest api return
This commit is contained in:
Alex Junior 2022-03-07 12:00:39 -03:00 committed by GitHub
parent c72b524ac0
commit d43da089bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 12 deletions

View File

@ -132,7 +132,7 @@ export interface IUser extends IRocketChatRecord, Omit<ILoggedUser, 'username' |
name?: string;
services?: IUserServices;
emails?: IUserEmail[];
status?: UserStatus;
status: UserStatus;
statusConnection?: string;
lastLogin?: Date;
avatarOrigin?: string;

View File

@ -34,4 +34,7 @@ export type UsersEndpoints = {
'users.register': {
POST: (params: { name: string; email: string; username: string; pass: string }) => { user: IUserRegistered };
};
'users.setStatus': {
POST: (params: { status: string; message: string }) => {};
};
};

View File

@ -265,10 +265,8 @@ export const setUserPreferences = (userId: string, data: Partial<INotificationPr
// RC 0.62.0
sdk.post('users.setPreferences', { userId, data });
export const setUserStatus = (status?: string, message?: string): any =>
export const setUserStatus = (status: string, message: string) =>
// RC 1.2.0
// TODO: missing definitions from server
// @ts-ignore
sdk.post('users.setStatus', { status, message });
export const setReaction = (emoji: string, messageId: string) =>

View File

@ -11,7 +11,7 @@ import SafeAreaView from '../containers/SafeAreaView';
import Status from '../containers/Status/Status';
import TextInput from '../containers/TextInput';
import { LISTENER } from '../containers/Toast';
import { IApplicationState, IBaseScreen } from '../definitions';
import { IApplicationState, IBaseScreen, IUser } from '../definitions';
import I18n from '../i18n';
import RocketChat from '../lib/rocketchat';
import { getUserSelector } from '../selectors/login';
@ -54,19 +54,13 @@ const styles = StyleSheet.create({
}
});
interface IUser {
id?: string;
status?: string;
statusText?: string;
}
interface IStatusViewState {
statusText: string;
loading: boolean;
}
interface IStatusViewProps extends IBaseScreen<any, 'StatusView'> {
user: IUser;
user: Pick<IUser, 'id' | 'status' | 'statusText'>;
isMasterDetail: boolean;
Accounts_AllowInvisibleStatusOption: boolean;
}