mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Refactor authentication and account management with modular UI components (#242)
This commit is contained in:
10
web/frontend/app/features/account/hooks/useSectionError.ts
Normal file
10
web/frontend/app/features/account/hooks/useSectionError.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { useEffect } from 'react';
|
||||
import { showErrorToast } from '../../../components/ui/toast/toast';
|
||||
import type { ActionResult } from '../types';
|
||||
|
||||
export const useSectionError = (result: ActionResult | undefined, intent: ActionResult['intent']) => {
|
||||
useEffect(() => {
|
||||
if (!result || result.intent !== intent) return;
|
||||
showErrorToast(result.error);
|
||||
}, [result, intent]);
|
||||
};
|
||||
Reference in New Issue
Block a user