mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 21:06:42 +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 })
|
.post<ApiUserLoginResult>(API.USER.LOGIN, { username, password })
|
||||||
.then(cleanResult);
|
.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) =>
|
export const apiAuthGetUserProfile = ({
|
||||||
api.get<ApiAuthGetUserProfileResult>(API.USER.PROFILE(username)).then(cleanResult);
|
username,
|
||||||
|
}: ApiAuthGetUserProfileRequest) =>
|
||||||
export const apiAuthGetUpdates = ({ exclude_dialogs, last }: ApiAuthGetUpdatesRequest) =>
|
|
||||||
api
|
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);
|
.then(cleanResult);
|
||||||
|
|
||||||
export const apiUpdateUser = ({ user }: ApiUpdateUserRequest) =>
|
export const apiUpdateUser = ({ user }: ApiUpdateUserRequest) =>
|
||||||
|
@ -47,25 +57,37 @@ export const apiRequestRestoreCode = (field: string) =>
|
||||||
.then(cleanResult);
|
.then(cleanResult);
|
||||||
|
|
||||||
export const apiCheckRestoreCode = ({ code }: ApiCheckRestoreCodeRequest) =>
|
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) =>
|
export const apiRestoreCode = ({ code, password }: ApiRestoreCodeRequest) =>
|
||||||
api
|
api
|
||||||
.post<ApiRestoreCodeResult>(API.USER.REQUEST_CODE(code), { password })
|
.put<ApiRestoreCodeResult>(API.USER.REQUEST_CODE(code), { password })
|
||||||
.then(cleanResult);
|
.then(cleanResult);
|
||||||
|
|
||||||
export const apiGetSocials = () =>
|
export const apiGetSocials = () =>
|
||||||
api.get<ApiGetSocialsResult>(API.USER.GET_SOCIALS).then(cleanResult);
|
api.get<ApiGetSocialsResult>(API.USER.GET_SOCIALS).then(cleanResult);
|
||||||
|
|
||||||
export const apiDropSocial = ({ id, provider }: ApiDropSocialRequest) =>
|
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) =>
|
export const apiAttachSocial = ({ token }: ApiAttachSocialRequest) =>
|
||||||
api
|
api
|
||||||
.post<ApiAttachSocialResult>(API.USER.ATTACH_SOCIAL, { token })
|
.post<ApiAttachSocialResult>(API.USER.ATTACH_SOCIAL, { token })
|
||||||
.then(cleanResult);
|
.then(cleanResult);
|
||||||
|
|
||||||
export const apiLoginWithSocial = ({ token, username, password }: ApiLoginWithSocialRequest) =>
|
export const apiLoginWithSocial = ({
|
||||||
|
token,
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
}: ApiLoginWithSocialRequest) =>
|
||||||
api
|
api
|
||||||
.post<ApiLoginWithSocialResult>(API.USER.LOGIN_WITH_SOCIAL, { token, username, password })
|
.post<ApiLoginWithSocialResult>(API.USER.LOGIN_WITH_SOCIAL, {
|
||||||
|
token,
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
})
|
||||||
.then(cleanResult);
|
.then(cleanResult);
|
||||||
|
|
|
@ -5,17 +5,17 @@ import { CONFIG } from '~/utils/config';
|
||||||
export const API = {
|
export const API = {
|
||||||
BASE: CONFIG.apiHost,
|
BASE: CONFIG.apiHost,
|
||||||
USER: {
|
USER: {
|
||||||
LOGIN: '/users/login',
|
LOGIN: '/auth',
|
||||||
OAUTH_WINDOW: (provider: OAuthProvider) =>
|
OAUTH_WINDOW: (provider: OAuthProvider) =>
|
||||||
`${CONFIG.apiHost}oauth/${provider}/redirect`,
|
`${CONFIG.apiHost}oauth/${provider}/redirect`,
|
||||||
ME: '/users/',
|
ME: '/auth',
|
||||||
PROFILE: (username: string) => `/users/user/${username}/profile`,
|
PROFILE: (username: string) => `/users/${username}/profile`,
|
||||||
MESSAGES: (username: string) => `/users/user/${username}/messages`,
|
MESSAGES: (username: string) => `/users/${username}/messages`,
|
||||||
MESSAGE_SEND: (username: string) => `/users/user/${username}/messages`,
|
MESSAGE_SEND: (username: string) => `/users/${username}/messages`,
|
||||||
MESSAGE_DELETE: (username: string, id: number) =>
|
MESSAGE_DELETE: (username: string, id: number) =>
|
||||||
`/users/user/${username}/messages/${id}`,
|
`/users/${username}/messages/${id}`,
|
||||||
GET_UPDATES: '/users/updates',
|
GET_UPDATES: '/auth/updates',
|
||||||
REQUEST_CODE: (code?: string) => `/users/restore/${code || ''}`,
|
REQUEST_CODE: (code?: string) => `/auth/restore/${code || ''}`,
|
||||||
UPLOAD: (target, type) => `/upload/${target}/${type}`,
|
UPLOAD: (target, type) => `/upload/${target}/${type}`,
|
||||||
|
|
||||||
GET_SOCIALS: '/oauth/',
|
GET_SOCIALS: '/oauth/',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue