export async function fetchDevicesIdsInRoute()

in src/store/general/actions.js [9:33]


export async function fetchDevicesIdsInRoute(
    { commit }) {
    try {
        let deviceIds = [];
        console.group("store/general/actions/fetchdevicesidsinroute");
        commit("SET_LOADER", true);
        commit("SET_DEVICEIDSINROUTE", []);

        const {
            // @ts-ignore
            data: { listDeliveryInfos: { items: results } }
        } = await API.graphql(graphqlOperation(listDevicesIds));        
        for (let i = 0; i < results.length; i++) {
            deviceIds.push(results[i].deliveryAgent.device.id)
        }
        commit("SET_DEVICEIDSINROUTE", deviceIds);
        commit("SET_LOADER", false);
        console.groupEnd();
    } catch (error) {
        console.error(error);
        commit("SET_LOADER", false);
        console.groupEnd();
        throw error;
    }
}