async function getAllEvents()

in sample/src/screens/HomeScreen.js [53:72]


  async function getAllEvents() {
    const filters = {
      startAt: {
        ge: parseInt(new Date().getTime() / 1000),
      },
    };

    const limit = 10;
    const allEvents = await API.graphql(
      graphqlOperation(listEvents, filters, limit)
    );
    setRefreshing(false);
    setEvents(
      allEvents.data.listEvents.items.sort(function (a, b) {
        if (!a.key) a.key = a.id;
        if (!b.key) b.key = b.id;
        return a.startAt === b.startAt ? 0 : a.startAt < b.startAt ? -1 : 1;
      })
    );
  }