mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +07:00
added account list and ability to drop them
This commit is contained in:
parent
2388a7e20e
commit
5396cf7611
11 changed files with 282 additions and 47 deletions
|
@ -2,7 +2,7 @@ import { api, errorMiddleware, resultMiddleware, configWithToken } from '~/utils
|
|||
import { API } from '~/constants/api';
|
||||
import { IResultWithStatus, IMessage, INotification } from '~/redux/types';
|
||||
import { userLoginTransform } from '~/redux/auth/transforms';
|
||||
import { IUser } from './types';
|
||||
import { ISocialAccount, IUser } from './types';
|
||||
|
||||
export const apiUserLogin = ({
|
||||
username,
|
||||
|
@ -55,9 +55,10 @@ export const apiAuthGetUpdates = ({
|
|||
access,
|
||||
exclude_dialogs,
|
||||
last,
|
||||
}): Promise<
|
||||
IResultWithStatus<{ notifications: INotification[]; boris: { commented_at: string } }>
|
||||
> =>
|
||||
}): Promise<IResultWithStatus<{
|
||||
notifications: INotification[];
|
||||
boris: { commented_at: string };
|
||||
}>> =>
|
||||
api
|
||||
.get(API.USER.GET_UPDATES, configWithToken(access, { params: { exclude_dialogs, last } }))
|
||||
.then(resultMiddleware)
|
||||
|
@ -86,3 +87,31 @@ export const apiRestoreCode = ({ code, password }): Promise<IResultWithStatus<{}
|
|||
.post(API.USER.REQUEST_CODE(code), { password })
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware);
|
||||
|
||||
export const apiGetSocials = ({
|
||||
access,
|
||||
}: {
|
||||
access: string;
|
||||
}): Promise<IResultWithStatus<{
|
||||
accounts: ISocialAccount[];
|
||||
}>> =>
|
||||
api
|
||||
.get(API.USER.GET_SOCIALS, configWithToken(access))
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware);
|
||||
|
||||
export const apiDropSocial = ({
|
||||
access,
|
||||
id,
|
||||
provider,
|
||||
}: {
|
||||
access: string;
|
||||
id: string;
|
||||
provider: string;
|
||||
}): Promise<IResultWithStatus<{
|
||||
accounts: ISocialAccount[];
|
||||
}>> =>
|
||||
api
|
||||
.delete(API.USER.DROP_SOCIAL(provider, id), configWithToken(access))
|
||||
.then(resultMiddleware)
|
||||
.catch(errorMiddleware);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue