Example #1
0
 .then(() => {
     fetch(url, h.fetchPost(state.config.csrf, data, 'POST'))
         .then((response) => {
             if (!response.ok) {
                 dispatch(setErrors(['An error occurred.']));
             }
             return response.json();
         })
         .then(() => setTimeout(() => dispatch(getExecuteStatus()), 3000));
 });
Example #2
0
    return (dispatch, getState) => {
        let state = getState(),
            patch = formatOutgoingRiskOfBias(state, scores),
            opts = h.fetchPost(state.config.csrf, patch, 'PUT');

        dispatch(resetError());
        return fetch(
            `${h.getObjectUrl(
                state.config.host,
                state.config.riskofbias.url,
                state.config.riskofbias.id
            )}`,
            opts
        )
            .then((response) => response.json())
            .then((json) => dispatch(updateFinalScores(json.scores)))
            .then(() => (window.location.href = state.config.cancelUrl))
            .catch((ex) => dispatch(setError(ex)));
    };
Example #3
0
 }).then(() => {
     fetch(url, h.fetchPost(state.config.csrf, data, 'POST')).then(() =>
         dispatch(setSelectedModel(model_id, notes))
     );
 });