mirror of
https://github.com/johndoe6345789/docker-swarm-termina.git
synced 2026-04-25 06:05:00 +00:00
23 lines
481 B
TypeScript
23 lines
481 B
TypeScript
// Global auth error handler
|
|
// This can be called from API client when auth errors occur
|
|
let authErrorCallback: (() => void) | null = null;
|
|
let authErrorHandled = false;
|
|
|
|
export const setAuthErrorCallback = (callback: () => void) => {
|
|
authErrorCallback = callback;
|
|
authErrorHandled = false;
|
|
};
|
|
|
|
export const triggerAuthError = () => {
|
|
if (!authErrorCallback) {
|
|
return;
|
|
}
|
|
|
|
if (authErrorHandled) {
|
|
return;
|
|
}
|
|
|
|
authErrorHandled = true;
|
|
authErrorCallback();
|
|
};
|