Untitled

mail@pastecode.io avatar
unknown
javascript
2 months ago
398 B
3
Indexable
Never
  try {
      setIsLoading(true);
      const res = await fetch(`${import.meta.env.VITE_API_URL}/notes`);
      if (!res.ok) {
        throw new Error("Something went wrong in getting Data");
      }
      const data = await res.json();
      setNotes(data);
      setIsLoading(false);
      setIsError(null);
    } catch (err) {
      setIsError(err.message);
      setIsLoading(false);
    }
  };
Leave a Comment