convert setting modals + associate function

This commit is contained in:
p2405951
2026-01-30 16:35:48 +01:00
parent 62a88dab83
commit 2389ca88e4
19 changed files with 670 additions and 294 deletions
+40
View File
@@ -0,0 +1,40 @@
/*export default async function getXSRFToken() {
const response = await fetch(`${import.meta.env.VITE_API_URL}/sanctum/csrf-cookie`, {
method: 'GET',
credentials: 'include'
});
if (!response.ok && response.status !== 204) {
throw new Error(`Error : ${response.status}`);
}
const name = 'XSRF-TOKEN';
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) {
return decodeURIComponent(parts.pop().split(';').shift());
}
throw new Error('Error: Invalid XSRF-TOKEN');
}*/
export default async function getXSRFToken(): Promise<string> {
const response = await fetch(`${import.meta.env.VITE_API_URL}/sanctum/csrf-cookie`, {
method: 'GET',
credentials: 'include'
});
if (!response.ok && response.status !== 204) {
throw new Error(`Error : ${response.status}`);
}
const name = 'XSRF-TOKEN';
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) {
return decodeURIComponent(parts.pop()!.split(';').shift()!);
}
throw new Error('Error: Invalid XSRF-TOKEN');
}