2017-10-27 02:06:20 -06:00
|
|
|
import axios from "axios";
|
|
|
|
import { FarmwareManifestEntry } from "./interfaces";
|
2018-02-14 22:07:36 -07:00
|
|
|
import { Actions } from "../constants";
|
2017-10-27 02:06:20 -06:00
|
|
|
|
|
|
|
const farmwareManifestUrl =
|
|
|
|
"https://raw.githubusercontent.com/FarmBot-Labs/farmware_manifests" +
|
|
|
|
"/master/manifest.json";
|
|
|
|
|
2018-02-14 22:07:36 -07:00
|
|
|
export const getFirstPartyFarmwareList = () => {
|
|
|
|
return (dispatch: Function) => {
|
2018-03-09 22:17:16 -07:00
|
|
|
axios.get<FarmwareManifestEntry[]>(farmwareManifestUrl)
|
|
|
|
.then(r => {
|
2018-02-14 22:07:36 -07:00
|
|
|
const names = r.data.map((fw: FarmwareManifestEntry) => {
|
|
|
|
return fw.name;
|
|
|
|
});
|
|
|
|
dispatch({
|
|
|
|
type: Actions.FETCH_FIRST_PARTY_FARMWARE_NAMES_OK,
|
|
|
|
payload: names
|
|
|
|
});
|
2017-10-27 02:06:20 -06:00
|
|
|
});
|
2018-02-14 22:07:36 -07:00
|
|
|
};
|
|
|
|
};
|