mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
fixed auth urls for new endpoints
This commit is contained in:
parent
4912fd255c
commit
c6a09c27c1
2 changed files with 41 additions and 19 deletions
|
@ -28,14 +28,24 @@ export const apiUserLogin = ({ username, password }: ApiUserLoginRequest) =>
|
|||
.post<ApiUserLoginResult>(API.USER.LOGIN, { username, password })
|
||||
.then(cleanResult);
|
||||
|
||||
export const apiAuthGetUser = () => api.get<ApiAuthGetUserResult>(API.USER.ME).then(cleanResult);
|
||||
export const apiAuthGetUser = () =>
|
||||
api.get<ApiAuthGetUserResult>(API.USER.ME).then(cleanResult);
|
||||
|
||||
export const apiAuthGetUserProfile = ({ username }: ApiAuthGetUserProfileRequest) =>
|
||||
api.get<ApiAuthGetUserProfileResult>(API.USER.PROFILE(username)).then(cleanResult);
|
||||
|
||||
export const apiAuthGetUpdates = ({ exclude_dialogs, last }: ApiAuthGetUpdatesRequest) =>
|
||||
export const apiAuthGetUserProfile = ({
|
||||
username,
|
||||
}: ApiAuthGetUserProfileRequest) =>
|
||||
api
|
||||
.get<ApiAuthGetUpdatesResult>(API.USER.GET_UPDATES, { params: { exclude_dialogs, last } })
|
||||
.get<ApiAuthGetUserProfileResult>(API.USER.PROFILE(username))
|
||||
.then(cleanResult);
|
||||
|
||||
export const apiAuthGetUpdates = ({
|
||||
exclude_dialogs,
|
||||
last,
|
||||
}: ApiAuthGetUpdatesRequest) =>
|
||||
api
|
||||
.get<ApiAuthGetUpdatesResult>(API.USER.GET_UPDATES, {
|
||||
params: { exclude_dialogs, last },
|
||||
})
|
||||
.then(cleanResult);
|
||||
|
||||
export const apiUpdateUser = ({ user }: ApiUpdateUserRequest) =>
|
||||
|
@ -47,25 +57,37 @@ export const apiRequestRestoreCode = (field: string) =>
|
|||
.then(cleanResult);
|
||||
|
||||
export const apiCheckRestoreCode = ({ code }: ApiCheckRestoreCodeRequest) =>
|
||||
api.get<ApiCheckRestoreCodeResult>(API.USER.REQUEST_CODE(code)).then(cleanResult);
|
||||
api
|
||||
.get<ApiCheckRestoreCodeResult>(API.USER.REQUEST_CODE(code))
|
||||
.then(cleanResult);
|
||||
|
||||
export const apiRestoreCode = ({ code, password }: ApiRestoreCodeRequest) =>
|
||||
api
|
||||
.post<ApiRestoreCodeResult>(API.USER.REQUEST_CODE(code), { password })
|
||||
.put<ApiRestoreCodeResult>(API.USER.REQUEST_CODE(code), { password })
|
||||
.then(cleanResult);
|
||||
|
||||
export const apiGetSocials = () =>
|
||||
api.get<ApiGetSocialsResult>(API.USER.GET_SOCIALS).then(cleanResult);
|
||||
|
||||
export const apiDropSocial = ({ id, provider }: ApiDropSocialRequest) =>
|
||||
api.delete<ApiDropSocialResult>(API.USER.DROP_SOCIAL(provider, id)).then(cleanResult);
|
||||
api
|
||||
.delete<ApiDropSocialResult>(API.USER.DROP_SOCIAL(provider, id))
|
||||
.then(cleanResult);
|
||||
|
||||
export const apiAttachSocial = ({ token }: ApiAttachSocialRequest) =>
|
||||
api
|
||||
.post<ApiAttachSocialResult>(API.USER.ATTACH_SOCIAL, { token })
|
||||
.then(cleanResult);
|
||||
|
||||
export const apiLoginWithSocial = ({ token, username, password }: ApiLoginWithSocialRequest) =>
|
||||
export const apiLoginWithSocial = ({
|
||||
token,
|
||||
username,
|
||||
password,
|
||||
}: ApiLoginWithSocialRequest) =>
|
||||
api
|
||||
.post<ApiLoginWithSocialResult>(API.USER.LOGIN_WITH_SOCIAL, { token, username, password })
|
||||
.post<ApiLoginWithSocialResult>(API.USER.LOGIN_WITH_SOCIAL, {
|
||||
token,
|
||||
username,
|
||||
password,
|
||||
})
|
||||
.then(cleanResult);
|
||||
|
|
|
@ -5,17 +5,17 @@ import { CONFIG } from '~/utils/config';
|
|||
export const API = {
|
||||
BASE: CONFIG.apiHost,
|
||||
USER: {
|
||||
LOGIN: '/users/login',
|
||||
LOGIN: '/auth',
|
||||
OAUTH_WINDOW: (provider: OAuthProvider) =>
|
||||
`${CONFIG.apiHost}oauth/${provider}/redirect`,
|
||||
ME: '/users/',
|
||||
PROFILE: (username: string) => `/users/user/${username}/profile`,
|
||||
MESSAGES: (username: string) => `/users/user/${username}/messages`,
|
||||
MESSAGE_SEND: (username: string) => `/users/user/${username}/messages`,
|
||||
ME: '/auth',
|
||||
PROFILE: (username: string) => `/users/${username}/profile`,
|
||||
MESSAGES: (username: string) => `/users/${username}/messages`,
|
||||
MESSAGE_SEND: (username: string) => `/users/${username}/messages`,
|
||||
MESSAGE_DELETE: (username: string, id: number) =>
|
||||
`/users/user/${username}/messages/${id}`,
|
||||
GET_UPDATES: '/users/updates',
|
||||
REQUEST_CODE: (code?: string) => `/users/restore/${code || ''}`,
|
||||
`/users/${username}/messages/${id}`,
|
||||
GET_UPDATES: '/auth/updates',
|
||||
REQUEST_CODE: (code?: string) => `/auth/restore/${code || ''}`,
|
||||
UPLOAD: (target, type) => `/upload/${target}/${type}`,
|
||||
|
||||
GET_SOCIALS: '/oauth/',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue