2025-01-13 21:36:52 +01:00
|
|
|
/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
|
2024-12-07 18:11:21 +00:00
|
|
|
|
2024-12-07 13:06:14 +01:00
|
|
|
import { data } from "autoprefixer";
|
|
|
|
import { getCsrfToken } from "../lib/utils";
|
|
|
|
|
|
|
|
export function getCaptchaChallenge({onRetrieve}: {onRetrieve: (id: string, url: string) => void}){
|
|
|
|
return fetch('/api/captcha', {
|
|
|
|
method: 'POST',
|
|
|
|
headers: {
|
|
|
|
'Accept': 'application/json',
|
|
|
|
'X-CSRF-TOKEN': getCsrfToken(),
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.then((response) => response.json())
|
|
|
|
.then((data: any) => {
|
|
|
|
onRetrieve(data.id, data.media_url)
|
|
|
|
})
|
|
|
|
.catch((error) => console.error(error));
|
|
|
|
}
|