fix admin invitations api url and account settings
This commit is contained in:
1 parent
7a18db2123
commit
ed0cc75615
10 files changed
+201
-14
No files matched your search
@@ -31,6 +31,7 @@ export interface AuthClient {
|
||||
login(input: LoginInput): Promise<AuthUser>
|
||||
register(input: RegisterInput): Promise<AuthUser>
|
||||
currentUser(): Promise<AuthUser | undefined>
|
||||
updateAccount(input: { displayName: string; currentPassword?: string; newPassword?: string }): Promise<AuthUser>
|
||||
logout(): Promise<void>
|
||||
}
|
||||
|
||||
@@ -77,6 +78,14 @@ class HttpAuthClient implements AuthClient {
|
||||
}
|
||||
}
|
||||
|
||||
async updateAccount(input: { displayName: string; currentPassword?: string; newPassword?: string }) {
|
||||
const payload = await this.request<{ user: AuthUser }>('/api/auth/account', {
|
||||
method: 'PATCH',
|
||||
body: JSON.stringify(input),
|
||||
})
|
||||
return payload.user
|
||||
}
|
||||
|
||||
async logout() {
|
||||
await this.request('/api/auth/logout', { method: 'POST' })
|
||||
}
|
||||
|
||||
@@ -161,6 +161,7 @@ export interface AdminAuditEvent {
|
||||
export interface AdminInvitation {
|
||||
id: string
|
||||
codePrefix: string
|
||||
code?: string
|
||||
label: string
|
||||
maxUses: number
|
||||
usedCount: number
|
||||
@@ -343,6 +344,10 @@ class HttpCatalogClient {
|
||||
return this.request<{ code: string; invitation: AdminInvitation }>('/api/admin/invitations', { method: 'POST', body: JSON.stringify(input) })
|
||||
}
|
||||
|
||||
async revokeAdminInvitation(id: string) {
|
||||
await this.request(`/api/admin/invitations/${encodeURIComponent(id)}/revoke`, { method: 'POST' })
|
||||
}
|
||||
|
||||
async listAdminProviders() {
|
||||
return this.request<{ providers: CatalogProvider[] }>('/api/admin/providers')
|
||||
}
|
||||
@@ -387,4 +392,6 @@ class HttpCatalogClient {
|
||||
|
||||
const controlPlaneUrl = (import.meta.env.VITE_CONTROL_PLANE_URL || 'http://127.0.0.1:8787').replace(/\/$/, '')
|
||||
export const catalogClient = new HttpCatalogClient(controlPlaneUrl)
|
||||
export const platformApiBaseUrl = (import.meta.env.VITE_PUBLIC_API_BASE_URL || `${controlPlaneUrl}/v1`).replace(/\/$/, '')
|
||||
const runtimeOrigin = typeof window !== 'undefined' ? window.location.origin : ''
|
||||
const publicApiOrigin = import.meta.env.VITE_CONTROL_PLANE_URL === '/' ? runtimeOrigin : controlPlaneUrl
|
||||
export const platformApiBaseUrl = (import.meta.env.VITE_PUBLIC_API_BASE_URL || `${publicApiOrigin}/v1`).replace(/\/$/, '')
|
||||
Reference in new issue
Block a user