Chore: Migrate REST API - saveUserProfile to Typescript (#3863)
* Chore: Migrate REST API - saveUserProfile to Typescript * minor tweak
This commit is contained in:
parent
b962925121
commit
60ecbe284c
|
@ -1,7 +1,7 @@
|
|||
import { StackNavigationProp } from '@react-navigation/stack';
|
||||
import React from 'react';
|
||||
|
||||
import { ProfileStackParamList } from '../../stacks/types';
|
||||
import { ProfileStackParamList } from '../stacks/types';
|
||||
|
||||
export interface IUser {
|
||||
id: string;
|
|
@ -1,3 +1,4 @@
|
|||
import { IParams } from '../../IProfileViewInterfaces';
|
||||
import type { ITeam } from '../../ITeam';
|
||||
import type { IUser } from '../../IUser';
|
||||
import { INotificationPreferences, IUserPreferences, IUserRegistered } from '../../IUser';
|
||||
|
@ -37,4 +38,9 @@ export type UsersEndpoints = {
|
|||
'users.setStatus': {
|
||||
POST: (params: { status: string; message: string }) => {};
|
||||
};
|
||||
'users.updateOwnBasicInfo': {
|
||||
POST: (params: { data: IParams | Pick<IParams, 'username'>; customFields?: { [key: string | number]: string } }) => {
|
||||
user: IUser;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -3,6 +3,7 @@ import { TEAM_TYPE } from '../../../definitions/ITeam';
|
|||
import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
|
||||
import { SubscriptionType, INotificationPreferences, IRoomNotifications } from '../../../definitions';
|
||||
import { ISpotlight } from '../../../definitions/ISpotlight';
|
||||
import { IParams } from '../../../definitions/IProfileViewInterfaces';
|
||||
|
||||
export const createChannel = ({
|
||||
name,
|
||||
|
@ -545,10 +546,8 @@ export const saveRoomSettings = (
|
|||
// RC 0.55.0
|
||||
sdk.methodCallWrapper('saveRoomSettings', rid, params);
|
||||
|
||||
export const saveUserProfile = (data: any, customFields?: any): any =>
|
||||
export const saveUserProfile = (data: IParams | Pick<IParams, 'username'>, customFields?: { [key: string | number]: string }) =>
|
||||
// RC 0.62.2
|
||||
// TODO: missing definitions from server
|
||||
// @ts-ignore
|
||||
sdk.post('users.updateOwnBasicInfo', { data, customFields });
|
||||
|
||||
export const saveUserPreferences = (data: Partial<INotificationPreferences>) =>
|
||||
|
|
|
@ -31,7 +31,15 @@ import { withTheme } from '../../theme';
|
|||
import { getUserSelector } from '../../selectors/login';
|
||||
import SafeAreaView from '../../containers/SafeAreaView';
|
||||
import styles from './styles';
|
||||
import { IAvatar, IAvatarButton, INavigationOptions, IParams, IProfileViewProps, IProfileViewState, IUser } from './interfaces';
|
||||
import {
|
||||
IAvatar,
|
||||
IAvatarButton,
|
||||
INavigationOptions,
|
||||
IParams,
|
||||
IProfileViewProps,
|
||||
IProfileViewState,
|
||||
IUser
|
||||
} from '../../definitions/IProfileViewInterfaces';
|
||||
|
||||
class ProfileView extends React.Component<IProfileViewProps, IProfileViewState> {
|
||||
private name: any;
|
||||
|
|
|
@ -34,7 +34,7 @@ import log, { events, logEvent } from '../../utils/log';
|
|||
import { MessageTypeValues } from '../../utils/messageTypes';
|
||||
import random from '../../utils/random';
|
||||
import scrollPersistTaps from '../../utils/scrollPersistTaps';
|
||||
import { IAvatar } from '../ProfileView/interfaces';
|
||||
import { IAvatar } from '../../definitions/IProfileViewInterfaces';
|
||||
import sharedStyles from '../Styles';
|
||||
import styles from './styles';
|
||||
import SwitchContainer from './SwitchContainer';
|
||||
|
|
Loading…
Reference in New Issue