mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-15 09:14:08 +00:00
build passes Create all missing components (modals, dropdowns, icons, tabs, mail drivers, customer partials), fix all @/scripts/ imports to @v2/, wire up vite entry point and blade template. 382 files, 48883 lines. - 27 settings components: modals (tax, payment, custom field, note, category, role, exchange rate, unit, mail test), dropdowns (6), customization tabs (4), mail driver forms (4) - 22 icon components: 5 utility icons, 4 dashboard icons, 13 editor toolbar icons with typed barrel export - 3 customer components: info, chart placeholder, custom fields single - Fixed usePopper composable, client/format-money import patterns - Zero remaining @/scripts/ imports in scripts-v2/ Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
103 lines
2.8 KiB
TypeScript
103 lines
2.8 KiB
TypeScript
import { client } from '../client'
|
|
import { API } from '../endpoints'
|
|
import type { User } from '@v2/types/domain/user'
|
|
import type { CompanyInvitation } from '@v2/types/domain/company'
|
|
import type { ApiResponse, PaginatedResponse, ListParams } from '@v2/types/api'
|
|
|
|
export interface MemberListParams extends ListParams {
|
|
display_name?: string
|
|
}
|
|
|
|
export interface MemberListResponse {
|
|
data: User[]
|
|
meta: {
|
|
current_page: number
|
|
last_page: number
|
|
per_page: number
|
|
total: number
|
|
}
|
|
}
|
|
|
|
export interface UpdateMemberPayload {
|
|
name?: string
|
|
email?: string
|
|
phone?: string | null
|
|
role?: string | null
|
|
companies?: Array<{
|
|
id: number
|
|
role?: string
|
|
}>
|
|
}
|
|
|
|
export interface InviteMemberPayload {
|
|
email: string
|
|
role?: string
|
|
}
|
|
|
|
export interface DeleteMembersPayload {
|
|
users: number[]
|
|
}
|
|
|
|
export interface PendingInvitationsResponse {
|
|
invitations: CompanyInvitation[]
|
|
}
|
|
|
|
export const memberService = {
|
|
async list(params?: MemberListParams): Promise<MemberListResponse> {
|
|
const { data } = await client.get(API.MEMBERS, { params })
|
|
return data
|
|
},
|
|
|
|
async get(id: number): Promise<ApiResponse<User>> {
|
|
const { data } = await client.get(`${API.MEMBERS}/${id}`)
|
|
return data
|
|
},
|
|
|
|
async create(payload: UpdateMemberPayload): Promise<ApiResponse<User>> {
|
|
const { data } = await client.post(API.MEMBERS, payload)
|
|
return data
|
|
},
|
|
|
|
async update(id: number, payload: UpdateMemberPayload): Promise<ApiResponse<User>> {
|
|
const { data } = await client.put(`${API.MEMBERS}/${id}`, payload)
|
|
return data
|
|
},
|
|
|
|
async delete(payload: DeleteMembersPayload): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(API.MEMBERS_DELETE, payload)
|
|
return data
|
|
},
|
|
|
|
// Company Invitations (send invitations)
|
|
async fetchPendingInvitations(): Promise<PendingInvitationsResponse> {
|
|
const { data } = await client.get(API.COMPANY_INVITATIONS)
|
|
return data
|
|
},
|
|
|
|
async invite(payload: InviteMemberPayload): Promise<ApiResponse<CompanyInvitation>> {
|
|
const { data } = await client.post(API.COMPANY_INVITATIONS, payload)
|
|
return data
|
|
},
|
|
|
|
async cancelInvitation(id: number): Promise<{ success: boolean }> {
|
|
const { data } = await client.delete(`${API.COMPANY_INVITATIONS}/${id}`)
|
|
return data
|
|
},
|
|
|
|
// User-scoped invitation responses
|
|
async fetchUserPendingInvitations(): Promise<PendingInvitationsResponse> {
|
|
const { data } = await client.get(API.INVITATIONS_PENDING)
|
|
return data
|
|
},
|
|
|
|
async acceptInvitation(token: string): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(`${API.INVITATIONS}/${token}/accept`)
|
|
return data
|
|
},
|
|
|
|
async declineInvitation(token: string): Promise<{ success: boolean }> {
|
|
const { data } = await client.post(`${API.INVITATIONS}/${token}/decline`)
|
|
return data
|
|
},
|
|
}
|