Unverified Commit 8efba393 authored by Reinaldo Neto's avatar Reinaldo Neto Committed by GitHub
Browse files

Chore: Migrate REST API - removePushToken to Typescript (#3903)

parent 823d4c65
......@@ -227,14 +227,6 @@ const RocketChat = {
return resolve();
});
},
removePushToken() {
const token = getDeviceToken();
if (token) {
// RC 0.60.0
return this.sdk.del('push.token', { token });
}
return Promise.resolve();
},
loadMissedMessages,
loadMessagesForRoom,
loadSurroundingMessages,
......
......@@ -8,12 +8,13 @@ import {
IUser,
TRocketChat
} from '../../../definitions';
import { TParams } from '../../../definitions/ILivechatEditView';
import { IAvatarSuggestion, IParams } from '../../../definitions/IProfileViewInterfaces';
import { ISpotlight } from '../../../definitions/ISpotlight';
import { TEAM_TYPE } from '../../../definitions/ITeam';
import { store as reduxStore, store } from '../../auxStore';
import { Encryption } from '../../encryption';
import { TParams } from '../../../definitions/ILivechatEditView';
import { store as reduxStore } from '../../auxStore';
import { getDeviceToken } from '../../../notifications/push';
import { compareServerVersion } from '../../utils';
import roomTypeToApiType, { RoomTypes } from '../methods/roomTypeToApiType';
import sdk from './sdk';
......@@ -766,7 +767,7 @@ export const useInviteToken = (token: string): any =>
sdk.post('useInviteToken', { token });
export const readThreads = (tmid: string): Promise<void> => {
const serverVersion = store.getState().server.version;
const serverVersion = reduxStore.getState().server.version;
if (compareServerVersion(serverVersion, 'greaterThanOrEqualTo', '3.4.0')) {
// RC 3.4.0
return sdk.methodCallWrapper('readThreads', tmid);
......@@ -812,6 +813,15 @@ export const editMessage = async (message: IMessage) => {
return sdk.post('chat.update', { roomId: rid, msgId: message.id, text: msg });
};
export const removePushToken = (): Promise<boolean | void> => {
const token = getDeviceToken();
if (token) {
// RC 0.60.0
return sdk.current.del('push.token', { token });
}
return Promise.resolve();
};
export const sendEmailCode = () => {
const { username } = reduxStore.getState().login.user as IUser;
// RC 3.1.0
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment