mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-14 17:54:42 +00:00
14 lines
411 B
TypeScript
14 lines
411 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]);
|
|
};
|