Update auth endpoints to account for new JSON responses
This commit is contained in:
parent
8c4bb89412
commit
4fd47b5908
|
@ -1,17 +1,23 @@
|
||||||
import {
|
import {
|
||||||
GetInitInfoResponse,
|
GetInitInfoResponse,
|
||||||
LoginRequest,
|
LoginRequest,
|
||||||
|
LoginResponse,
|
||||||
LogoutResponse,
|
LogoutResponse,
|
||||||
PasswordResetRequest,
|
PasswordResetRequest,
|
||||||
PasswordResetResponse,
|
PasswordResetResponse,
|
||||||
PasswordResetUpdateRequest,
|
PasswordResetUpdateRequest,
|
||||||
PasswordResetUpdateResponse,
|
PasswordResetUpdateResponse,
|
||||||
SetInitInfoRequest,
|
SetInitInfoRequest,
|
||||||
|
SetInitInfoResponse,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { BaseAPIClient } from "./types"
|
import { BaseAPIClient } from "./types"
|
||||||
|
|
||||||
export interface AuthEndpoints {
|
export interface AuthEndpoints {
|
||||||
logIn: (tenantId: string, username: string, password: string) => Promise<void>
|
logIn: (
|
||||||
|
tenantId: string,
|
||||||
|
username: string,
|
||||||
|
password: string
|
||||||
|
) => Promise<LoginResponse>
|
||||||
logOut: () => Promise<LogoutResponse>
|
logOut: () => Promise<LogoutResponse>
|
||||||
requestForgotPassword: (
|
requestForgotPassword: (
|
||||||
tenantId: string,
|
tenantId: string,
|
||||||
|
@ -22,7 +28,7 @@ export interface AuthEndpoints {
|
||||||
password: string,
|
password: string,
|
||||||
resetCode: string
|
resetCode: string
|
||||||
) => Promise<PasswordResetUpdateResponse>
|
) => Promise<PasswordResetUpdateResponse>
|
||||||
setInitInfo: (info: SetInitInfoRequest) => Promise<void>
|
setInitInfo: (info: SetInitInfoRequest) => Promise<SetInitInfoResponse>
|
||||||
getInitInfo: () => Promise<GetInitInfoResponse>
|
getInitInfo: () => Promise<GetInitInfoResponse>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,13 +40,12 @@ export const buildAuthEndpoints = (API: BaseAPIClient): AuthEndpoints => ({
|
||||||
* @param password the password
|
* @param password the password
|
||||||
*/
|
*/
|
||||||
logIn: async (tenantId, username, password) => {
|
logIn: async (tenantId, username, password) => {
|
||||||
return await API.post<LoginRequest>({
|
return await API.post<LoginRequest, LoginResponse>({
|
||||||
url: `/api/global/auth/${tenantId}/login`,
|
url: `/api/global/auth/${tenantId}/login`,
|
||||||
body: {
|
body: {
|
||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
},
|
},
|
||||||
parseResponse: () => undefined,
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue