diff --git a/src/constants/api.ts b/src/constants/api.ts index 66f7069b..991fe958 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -11,6 +11,7 @@ export const API = { PROFILE: (username: string) => `/user/user/${username}/profile`, MESSAGES: (username: string) => `/user/user/${username}/messages`, MESSAGE_SEND: (username: string) => `/user/user/${username}/messages`, + MESSAGE_DELETE: (username: string, id: number) => `/user/user/${username}/messages/${id}`, GET_UPDATES: '/user/updates', REQUEST_CODE: (code?: string) => `/user/restore/${code || ''}`, UPLOAD: (target, type) => `/upload/${target}/${type}`, @@ -19,8 +20,6 @@ export const API = { DROP_SOCIAL: (provider, id) => `/oauth/${provider}/${id}`, ATTACH_SOCIAL: `/oauth/attach`, LOGIN_WITH_SOCIAL: `/oauth/login`, - // TODO: REMOVE - VKONTAKTE_LOGIN: `${process.env.API_HOST}/oauth/vkontakte/redirect/login`, }, NODE: { SAVE: '/node/', diff --git a/src/redux/auth/api.ts b/src/redux/auth/api.ts index 54a78223..5b54d330 100644 --- a/src/redux/auth/api.ts +++ b/src/redux/auth/api.ts @@ -51,6 +51,20 @@ export const apiAuthSendMessage = ({ .then(resultMiddleware) .catch(errorMiddleware); +export const apiAuthDeleteMessage = ({ + access, + username, + id, +}: { + access: string; + username: string; + id: number; +}): Promise> => + api + .delete(API.USER.MESSAGE_DELETE(username, id), configWithToken(access)) + .then(resultMiddleware) + .catch(errorMiddleware); + export const apiAuthGetUpdates = ({ access, exclude_dialogs,