- Implemented the initial version of the web interface. refactor: Begin Telegram bot refactoring - Started restructuring the bot’s code for better maintainability. chore: Migrate to Flask project structure - Reorganized the application to follow Flask's project structure. cleanup: Extensive code cleanup - Removed redundant code and improved readability. Signed-off-by: UdoChudo <stream@udochudo.ru>
21 lines
627 B
JavaScript
21 lines
627 B
JavaScript
|
|
window.safeFetch = function(url, options = {}) {
|
|
return fetch(url, options).then(response => {
|
|
if (response.status === 401) {
|
|
window.location.href = `${window.location.origin}/telezab/login`;
|
|
throw new Error("Unauthorized");
|
|
}
|
|
return response;
|
|
});
|
|
};
|
|
|
|
|
|
window.safeFetchJson = function(url, options = {}) {
|
|
return fetch(url, options).then(response => {
|
|
if (response.status === 401) {
|
|
window.location.href = `${window.location.origin}/telezab/login`;
|
|
throw new Error("Unauthorized");
|
|
}
|
|
return response.json();
|
|
});
|
|
}; |