1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-04-25 21:06:42 +07:00

attaching accounts and displaying errors

This commit is contained in:
Fedor Katurov 2020-07-27 18:17:48 +07:00
parent 3ae22fb63d
commit b1c71faf3a
9 changed files with 140 additions and 18 deletions

View file

@ -1,6 +1,6 @@
import { api, errorMiddleware, resultMiddleware, configWithToken } from '~/utils/api';
import { api, configWithToken, errorMiddleware, resultMiddleware } from '~/utils/api';
import { API } from '~/constants/api';
import { IResultWithStatus, IMessage, INotification } from '~/redux/types';
import { IMessage, INotification, IResultWithStatus } from '~/redux/types';
import { userLoginTransform } from '~/redux/auth/transforms';
import { ISocialAccount, IUser } from './types';
@ -115,3 +115,17 @@ export const apiDropSocial = ({
.delete(API.USER.DROP_SOCIAL(provider, id), configWithToken(access))
.then(resultMiddleware)
.catch(errorMiddleware);
export const apiAttachSocial = ({
access,
token,
}: {
access: string;
token: string;
}): Promise<IResultWithStatus<{
account: ISocialAccount;
}>> =>
api
.post(API.USER.ATTACH_SOCIAL, { token }, configWithToken(access))
.then(resultMiddleware)
.catch(errorMiddleware);