Closed jamesspearsv closed 1 week ago
Add a utility function to evaluate API response status and set auth if needed.
Example
const res = await fetch(url, options); const json = await res.json(); // evaluate response status function if (res.status === 401) { toast.error("Session expired") return setAuth(null); } else if (!res.ok) throw new Error(message);
Add a utility function to evaluate API response status and set auth if needed.
Example