aktueller stand

This commit is contained in:
2026-01-29 17:50:31 +01:00
parent 916ca1dbc2
commit 9f2825edd4
4 changed files with 4794 additions and 20 deletions

View File

@@ -6,6 +6,21 @@ function isUnauthorizedError(error) {
return status === 401 || status === 403;
}
function isCsrfError(error) {
const status = error?.response?.status;
if (status !== 400) {
return false;
}
const data = error?.response?.data;
const message =
typeof data === 'string'
? data
: typeof data?.message === 'string'
? data.message
: '';
return message.toLowerCase().includes('csrf');
}
async function refreshSession(session, { label } = {}) {
if (!session?.credentials?.email || !session?.credentials?.password) {
console.warn(
@@ -62,7 +77,7 @@ async function withSessionRetry(session, action, { label } = {}) {
try {
return await action();
} catch (error) {
if (!isUnauthorizedError(error)) {
if (!isUnauthorizedError(error) && !isCsrfError(error)) {
throw error;
}
const refreshed = await refreshSession(session, { label });