

import toast from "react-hot-toast";
import { ActionResult } from "./ActionResult";


export function handleActionResult<T>(actionResult:ActionResult<T>): T | undefined
{
    if(actionResult.error) toast.error(actionResult.error,{position:"top-center",duration:10000})
    else return actionResult.result;
}