Upload source code
This commit is contained in:
12
src/client/utils/toastHandler.ts
Normal file
12
src/client/utils/toastHandler.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
// Global toast handler for use outside React components (like in axios interceptor)
|
||||
let globalShowGuestWarning: (() => void) | null = null;
|
||||
|
||||
export const setGlobalToastHandler = (handler: () => void) => {
|
||||
globalShowGuestWarning = handler;
|
||||
};
|
||||
|
||||
export const triggerGuestWarning = () => {
|
||||
if (globalShowGuestWarning) {
|
||||
globalShowGuestWarning();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user