mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 18:14:44 +00:00
11 lines
400 B
TypeScript
11 lines
400 B
TypeScript
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]);
|
|
};
|