37 lines
1006 B
TypeScript
37 lines
1006 B
TypeScript
// Metro module 13894 (f13895).
|
|
import { Endpoints } from "../../Constants";
|
|
import Dispatcher from "../../Dispatcher";
|
|
import { HTTP } from "../../_bundle/sendRequest";
|
|
import { requestHarvest } from "../../actions/UserSettingsAccountActionCreators";
|
|
export function getDataHarvestStatus() {
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_DATA_HARVEST_TYPE_START"
|
|
});
|
|
return HTTP.get({
|
|
url: Endpoints.USER_HARVEST,
|
|
oldFormErrors: true,
|
|
rejectWithError: false
|
|
}).then((result) => {
|
|
Dispatcher.dispatch({
|
|
type: "UPDATE_DATA_HARVEST_TYPE",
|
|
harvestType: result.body
|
|
});
|
|
}).catch((a0) => {
|
|
Dispatcher.dispatch({
|
|
type: "LOAD_DATA_HARVEST_TYPE_FAILURE",
|
|
error: a0
|
|
});
|
|
});
|
|
}
|
|
export function requestDataHarvest(a0) {
|
|
return requestHarvest(a0).then((result) => {
|
|
if (result != null && result.body != null) {
|
|
Dispatcher.dispatch({
|
|
type: "UPDATE_DATA_HARVEST_TYPE",
|
|
harvestType: result.body
|
|
});
|
|
}
|
|
return result;
|
|
});
|
|
}
|