25 lines
648 B
TypeScript
25 lines
648 B
TypeScript
|
|
import { client } from "./client";
|
||
|
|
import { components } from "../generated/api";
|
||
|
|
|
||
|
|
type Invite = components["schemas"]["UserInviteResponse"];
|
||
|
|
type InviteCheckResponse = components["schemas"]["InviteCheckResponse"];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Invites API endpoints (user-facing)
|
||
|
|
*/
|
||
|
|
export const invitesApi = {
|
||
|
|
/**
|
||
|
|
* Get all invites for the current user
|
||
|
|
*/
|
||
|
|
getInvites(): Promise<Invite[]> {
|
||
|
|
return client.get<Invite[]>("/api/invites");
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Check if an invite code is valid
|
||
|
|
*/
|
||
|
|
checkInvite(code: string): Promise<InviteCheckResponse> {
|
||
|
|
return client.get<InviteCheckResponse>(`/api/invites/${encodeURIComponent(code)}/check`);
|
||
|
|
},
|
||
|
|
};
|