feat: add captcha functionality to PublicDashboardPage and OrganizationSettings components
This commit is contained in:
@@ -81,10 +81,19 @@ export async function getOrganizationMembers(organizationId: string): Promise<Or
|
||||
}
|
||||
|
||||
// Send an invitation
|
||||
export async function sendInvitation(organizationId: string, email: string, role: string = 'member'): Promise<OrganizationInvitation> {
|
||||
export async function sendInvitation(
|
||||
organizationId: string,
|
||||
email: string,
|
||||
role: string = 'member',
|
||||
captcha?: { captcha_id?: string, captcha_solution?: string, captcha_token?: string }
|
||||
): Promise<OrganizationInvitation> {
|
||||
return await authFetch<OrganizationInvitation>(`/auth/organizations/${organizationId}/invites`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ email, role }),
|
||||
body: JSON.stringify({
|
||||
email,
|
||||
role,
|
||||
...captcha
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -236,12 +236,24 @@ export async function getDashboard(siteId: string, startDate?: string, endDate?:
|
||||
return apiRequest<DashboardData>(`/sites/${siteId}/dashboard?${params.toString()}`)
|
||||
}
|
||||
|
||||
export async function getPublicDashboard(siteId: string, startDate?: string, endDate?: string, limit = 10, interval?: string, password?: string): Promise<DashboardData> {
|
||||
export async function getPublicDashboard(
|
||||
siteId: string,
|
||||
startDate?: string,
|
||||
endDate?: string,
|
||||
limit = 10,
|
||||
interval?: string,
|
||||
password?: string,
|
||||
captcha?: { captcha_id?: string, captcha_solution?: string, captcha_token?: string }
|
||||
): Promise<DashboardData> {
|
||||
const params = new URLSearchParams()
|
||||
if (startDate) params.append('start_date', startDate)
|
||||
if (endDate) params.append('end_date', endDate)
|
||||
if (interval) params.append('interval', interval)
|
||||
if (password) params.append('password', password)
|
||||
if (captcha?.captcha_id) params.append('captcha_id', captcha.captcha_id)
|
||||
if (captcha?.captcha_solution) params.append('captcha_solution', captcha.captcha_solution)
|
||||
if (captcha?.captcha_token) params.append('captcha_token', captcha.captcha_token)
|
||||
|
||||
params.append('limit', limit.toString())
|
||||
return apiRequest<DashboardData>(`/public/sites/${siteId}/dashboard?${params.toString()}`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user