vor ähnlichkeitsprüfung
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
(() => {
|
||||
const API_URL = 'https://fb.srv.medeba-media.de/api';
|
||||
const LOGIN_PAGE = 'login.html';
|
||||
|
||||
const PROVIDER_MODELS = {
|
||||
gemini: [
|
||||
@@ -72,8 +73,25 @@ let moderationSettings = {
|
||||
sports_auto_hide_enabled: false
|
||||
};
|
||||
|
||||
function handleUnauthorized(response) {
|
||||
if (response && response.status === 401) {
|
||||
if (typeof redirectToLogin === 'function') {
|
||||
redirectToLogin();
|
||||
} else {
|
||||
window.location.href = LOGIN_PAGE;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function apiFetch(url, options = {}) {
|
||||
return fetch(url, {...options, credentials: 'include'});
|
||||
return fetch(url, {...options, credentials: 'include'}).then((response) => {
|
||||
if (handleUnauthorized(response)) {
|
||||
throw new Error('Nicht angemeldet');
|
||||
}
|
||||
return response;
|
||||
});
|
||||
}
|
||||
|
||||
function showToast(message, type = 'info') {
|
||||
|
||||
Reference in New Issue
Block a user