offset-dev / strapi-calendar

Visualize your Strapi content in month, week or daily view
36 stars 13 forks source link

Calendar not getting data #6

Closed zadinvit closed 2 years ago

zadinvit commented 2 years ago

Hi, calendar don't showing data. Only show error message that I don't have data in collection. I found that bug is in pages/index.js you calling api.getData() but I think you need call api.GetCollections(). Atleast this fix problem for me.

Fixed functions here:

const load = date => {
    setLoading(true);
    api.getCollections(date).then(r => {
      setData(r.data);
      setLoading(false);
    });
  };

  const initialLoad = () => {
    api.getCollections().then(r => {
      setData(r.data);
    });
    api.getSettings().then(r => {
      if (r.data) {
        setSettings(r.data);
        setState(s => ({ ...s, view: r.data.defaultView }));
      }
      setLoading(false);
    });
  };
LuisRodriguezLD commented 2 years ago

Thanks for reporting. The issue was a little different, but I've patched this. Please upgrade to v0.0.7 and reopen if issue persists.