mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-29 02:46:25 +02:00
feat: add getInviteInfo method to invites API service
This commit is contained in:
parent
d32c824412
commit
0cf85943d2
1 changed files with 21 additions and 2 deletions
|
|
@ -109,6 +109,25 @@ class InvitesApiService {
|
||||||
deleteInviteResponse
|
deleteInviteResponse
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get invite info by invite code
|
||||||
|
*/
|
||||||
|
getInviteInfo = async (request: GetInviteInfoRequest) => {
|
||||||
|
const parsedRequest = getInviteInfoRequest.safeParse(request);
|
||||||
|
|
||||||
|
if (!parsedRequest.success) {
|
||||||
|
console.error("Invalid request:", parsedRequest.error);
|
||||||
|
|
||||||
|
const errorMessage = parsedRequest.error.errors.map((err) => err.message).join(", ");
|
||||||
|
throw new ValidationError(`Invalid request: ${errorMessage}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return baseApiService.get(
|
||||||
|
`/api/v1/invites/${parsedRequest.data.invite_code}/info`,
|
||||||
|
getInviteInfoResponse
|
||||||
|
);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const invitesApiService = new InvitesApiService();
|
export const invitesApiService = new InvitesApiService();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue