feat: self-serve signup Phase 2 (frontend cutover) (#162)
Co-authored-by: Michael Chihlas <michael@resolutionflow.com> Co-committed-by: Michael Chihlas <michael@resolutionflow.com>
This commit was merged in pull request #162.
This commit is contained in:
@@ -1,6 +1,22 @@
|
||||
import apiClient from './client'
|
||||
import type { Account, SubscriptionDetails, AccountMember, AccountInvite } from '@/types'
|
||||
|
||||
export interface BulkInviteRow {
|
||||
email: string
|
||||
role: 'engineer' | 'viewer'
|
||||
expires_in_days?: number
|
||||
}
|
||||
|
||||
export interface BulkInviteFailure {
|
||||
email: string
|
||||
error: string
|
||||
}
|
||||
|
||||
export interface BulkInviteResponse {
|
||||
created: AccountInvite[]
|
||||
failed: BulkInviteFailure[]
|
||||
}
|
||||
|
||||
export const accountsApi = {
|
||||
async getMyAccount(): Promise<Account> {
|
||||
const response = await apiClient.get<Account>('/accounts/me')
|
||||
@@ -39,6 +55,18 @@ export const accountsApi = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
/**
|
||||
* Create multiple invites in one call (used by the welcome wizard step 3).
|
||||
* Per-row failures land in `failed[]`; successes in `created[]`.
|
||||
*/
|
||||
async bulkInvite(invites: BulkInviteRow[]): Promise<BulkInviteResponse> {
|
||||
const response = await apiClient.post<BulkInviteResponse>(
|
||||
'/accounts/me/invites/bulk',
|
||||
{ invites },
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
async getInvites(): Promise<AccountInvite[]> {
|
||||
const response = await apiClient.get<AccountInvite[]>('/accounts/me/invites')
|
||||
return response.data
|
||||
|
||||
Reference in New Issue
Block a user