2018-02-26 12:16:15 +01:00
|
|
|
// import { LOCATION_CHANGE } from 'react-router-redux';
|
2018-02-28 12:46:12 +01:00
|
|
|
import { call, fork, put, takeLatest } from 'redux-saga/effects';
|
|
|
|
import request from 'utils/request';
|
2018-02-26 12:16:15 +01:00
|
|
|
|
2018-02-28 12:46:12 +01:00
|
|
|
import {
|
|
|
|
getSettingsSucceeded,
|
|
|
|
} from './actions';
|
|
|
|
import {
|
|
|
|
GET_SETTINGS,
|
|
|
|
} from './constants';
|
|
|
|
|
|
|
|
export function* settingsGet(action) {
|
|
|
|
try {
|
|
|
|
const requestURL = `/upload/settings/${action.env}`;
|
|
|
|
const response = yield call(request, requestURL, { method: 'GET' });
|
|
|
|
yield put(getSettingsSucceeded(response));
|
|
|
|
} catch(err) {
|
|
|
|
strapi.notification.error('notification.error');
|
|
|
|
}
|
|
|
|
}
|
2018-02-26 12:16:15 +01:00
|
|
|
|
2018-02-28 12:46:12 +01:00
|
|
|
function* defaultSaga() {
|
|
|
|
yield fork(takeLatest, GET_SETTINGS, settingsGet);
|
2018-02-26 12:16:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export default defaultSaga;
|