feat: use new invite status endpoint to display different invite type counts
This commit is contained in:
+9
-1
@@ -1,6 +1,6 @@
|
||||
import { apiClient } from '@/api/client'
|
||||
import { extractErrorMessage } from '@/api/http'
|
||||
import type { Invite, PaginatedInvites } from '@/types/invite'
|
||||
import type { Invite, InviteStatusCounts, PaginatedInvites } from '@/types/invite'
|
||||
|
||||
export interface GetInvitesParams {
|
||||
page?: number
|
||||
@@ -20,6 +20,14 @@ export async function getInvitesApi(params: GetInvitesParams = {}): Promise<Pagi
|
||||
return response.json()
|
||||
}
|
||||
|
||||
export async function getInviteStatusApi(): Promise<InviteStatusCounts> {
|
||||
const response = await apiClient.get('/user/invites/status')
|
||||
if (!response.ok) {
|
||||
throw new Error(await extractErrorMessage(response, 'Failed to load invite counts'))
|
||||
}
|
||||
return response.json()
|
||||
}
|
||||
|
||||
export async function createInviteApi(): Promise<Invite> {
|
||||
const response = await apiClient.post('/user/invites')
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user