mirror of
https://github.com/strapi/strapi.git
synced 2025-12-26 22:54:31 +00:00
Fix redux-sagas deprecation warnings
This commit is contained in:
parent
ded277158a
commit
de89b3156f
@ -2,15 +2,14 @@ import 'whatwg-fetch';
|
||||
import { dropRight, take } from 'lodash';
|
||||
import removeMd from 'remove-markdown';
|
||||
import {
|
||||
all,
|
||||
call,
|
||||
fork,
|
||||
put,
|
||||
select,
|
||||
takeLatest,
|
||||
} from 'redux-saga/effects';
|
||||
|
||||
import request from 'utils/request';
|
||||
|
||||
import { getArticlesSucceeded, submitSucceeded } from './actions';
|
||||
import { GET_ARTICLES, SUBMIT } from './constants';
|
||||
import { makeSelectBody } from './selectors';
|
||||
@ -51,8 +50,10 @@ function* submit() {
|
||||
}
|
||||
|
||||
function* defaultSaga() {
|
||||
yield fork(takeLatest, SUBMIT, submit);
|
||||
yield fork(takeLatest, GET_ARTICLES, getArticles);
|
||||
yield all([
|
||||
fork(takeLatest, SUBMIT, submit),
|
||||
fork(takeLatest, GET_ARTICLES, getArticles),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1,10 +1,9 @@
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import { get } from 'lodash';
|
||||
import { fork, call, put, select, takeLatest, take, cancel } from 'redux-saga/effects';
|
||||
import { all, fork, call, put, select, takeLatest, take, cancel } from 'redux-saga/effects';
|
||||
import { pluginDeleted } from 'containers/App/actions';
|
||||
import auth from 'utils/auth';
|
||||
import request from 'utils/request';
|
||||
|
||||
import { selectLocale } from '../LanguageProvider/selectors';
|
||||
import { deletePluginSucceeded, getAppCurrentEnvSucceeded, getPluginsSucceeded } from './actions';
|
||||
import { GET_PLUGINS, ON_DELETE_PLUGIN_CONFIRM } from './constants';
|
||||
@ -36,10 +35,10 @@ export function* deletePlugin() {
|
||||
export function* pluginsGet() {
|
||||
try {
|
||||
// Fetch plugins.
|
||||
const response = yield [
|
||||
const response = yield all([
|
||||
call(request, '/admin/plugins', { method: 'GET' }),
|
||||
call(request, '/admin/currentEnvironment', { method: 'GET' }),
|
||||
];
|
||||
]);
|
||||
const locale = yield select(selectLocale());
|
||||
|
||||
const opts = {
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import { fork, put, call, takeLatest, take, cancel, select } from 'redux-saga/effects';
|
||||
import request from 'utils/request';
|
||||
|
||||
|
||||
import { getModelEntriesSucceeded, loadedModels, submitSucceeded } from './actions';
|
||||
import { GET_MODEL_ENTRIES, LOAD_MODELS, ON_SUBMIT } from './constants';
|
||||
import { makeSelectModifiedSchema } from './selectors';
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import { findIndex, get, isArray, isEmpty, includes, isNumber, isString, map } from 'lodash';
|
||||
import {
|
||||
all,
|
||||
call,
|
||||
cancel,
|
||||
fork,
|
||||
@ -34,9 +35,9 @@ function* dataGet(action) {
|
||||
try {
|
||||
const modelName = yield select(makeSelectModelName());
|
||||
const params = { source: action.source };
|
||||
const [response] = yield [
|
||||
const [response] = yield all([
|
||||
call(request, `/content-manager/explorer/${modelName}/${action.id}`, { method: 'GET', params }),
|
||||
];
|
||||
]);
|
||||
const pluginHeaderTitle = yield call(templateObject, { mainField: action.mainField }, response);
|
||||
|
||||
yield put(getDataSucceeded(action.id, response, pluginHeaderTitle.mainField));
|
||||
@ -74,6 +75,7 @@ export function* submit() {
|
||||
const source = yield select(makeSelectSource());
|
||||
const schema = yield select(makeSelectSchema());
|
||||
let shouldAddTranslationSuffix = false;
|
||||
|
||||
// Remove the updated_at & created_at fields so it is updated correctly when using Postgres or MySQL db
|
||||
if (record.updated_at) {
|
||||
delete record.created_at;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// Dependencies.
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import {
|
||||
all,
|
||||
call,
|
||||
cancel,
|
||||
fork,
|
||||
@ -9,10 +10,8 @@ import {
|
||||
take,
|
||||
takeLatest,
|
||||
} from 'redux-saga/effects';
|
||||
|
||||
// Utils.
|
||||
import request from 'utils/request';
|
||||
|
||||
// Actions
|
||||
import {
|
||||
deleteDataSuccess,
|
||||
@ -63,10 +62,10 @@ export function* dataGet(action) {
|
||||
params._q = _q;
|
||||
}
|
||||
|
||||
const response = yield [
|
||||
const response = yield all([
|
||||
call(request, countURL, { method: 'GET', params }),
|
||||
call(request, recordsURL, { method: 'GET', params }),
|
||||
];
|
||||
]);
|
||||
|
||||
yield put(getDataSucceeded(response));
|
||||
} catch(err) {
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
// import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import { call, fork, put, select, takeLatest } from 'redux-saga/effects';
|
||||
import { all, call, fork, put, select, takeLatest } from 'redux-saga/effects';
|
||||
import request from 'utils/request';
|
||||
|
||||
import {
|
||||
getSettingsSucceeded,
|
||||
submitSucceeded,
|
||||
@ -18,10 +17,10 @@ import {
|
||||
export function* settingsGet(action) {
|
||||
try {
|
||||
const requestURL = `/email/settings/${action.env}`;
|
||||
const response = yield [
|
||||
const response = yield all([
|
||||
call(request, requestURL, { method: 'GET' }),
|
||||
call(request, '/email/environments', { method: 'GET' }),
|
||||
];
|
||||
]);
|
||||
|
||||
yield put(getSettingsSucceeded(response[0], response[1].environments));
|
||||
} catch(err) {
|
||||
|
||||
@ -1,11 +1,9 @@
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import { forEach, set, map, replace } from 'lodash';
|
||||
import { call, take, put, fork, cancel, select, takeLatest } from 'redux-saga/effects';
|
||||
import { all, call, take, put, fork, cancel, select, takeLatest } from 'redux-saga/effects';
|
||||
import request from 'utils/request';
|
||||
|
||||
// selectors
|
||||
import { makeSelectModifiedData } from './selectors';
|
||||
|
||||
import {
|
||||
CONFIG_FETCH,
|
||||
EDIT_SETTINGS,
|
||||
@ -18,7 +16,6 @@ import {
|
||||
SPECIFIC_DATABASE_FETCH,
|
||||
DATABASE_EDIT,
|
||||
} from './constants';
|
||||
|
||||
import {
|
||||
configFetchSucceded,
|
||||
databasesFetchSucceeded,
|
||||
@ -121,10 +118,10 @@ export function* fetchDatabases(action) {
|
||||
const requestUrlListDatabases = `/settings-manager/configurations/databases/${action.environment}`;
|
||||
const requestUrlAppDatabases = '/settings-manager/configurations/database/model';
|
||||
|
||||
const [listDatabasesData, appDatabaseData] = yield [
|
||||
const [listDatabasesData, appDatabaseData] = yield all([
|
||||
call(request, requestUrlListDatabases, opts),
|
||||
call(request, requestUrlAppDatabases, opts),
|
||||
];
|
||||
]);
|
||||
yield put(databasesFetchSucceeded(listDatabasesData, appDatabaseData));
|
||||
} catch(error) {
|
||||
strapi.notification.error('settings-manager.strapi.notification.error');
|
||||
@ -139,10 +136,10 @@ export function* fetchLanguages() {
|
||||
const requestUrlAppLanguages = '/settings-manager/configurations/languages';
|
||||
const requestUrlListLanguages = '/settings-manager/configurations/i18n';
|
||||
|
||||
const [appLanguagesData, listLanguagesData] = yield [
|
||||
const [appLanguagesData, listLanguagesData] = yield all([
|
||||
call(request, requestUrlAppLanguages, opts),
|
||||
call(request, requestUrlListLanguages, opts),
|
||||
];
|
||||
]);
|
||||
yield put(languagesFetchSucceeded(appLanguagesData, listLanguagesData));
|
||||
} catch(error) {
|
||||
strapi.notification.error('settings-manager.strapi.notification.error');
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
// import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import { call, fork, put, select, takeLatest } from 'redux-saga/effects';
|
||||
import { all, call, fork, put, select, takeLatest } from 'redux-saga/effects';
|
||||
import request from 'utils/request';
|
||||
|
||||
import {
|
||||
getSettingsSucceeded,
|
||||
submitSucceeded,
|
||||
@ -18,10 +16,10 @@ import {
|
||||
export function* settingsGet(action) {
|
||||
try {
|
||||
const requestURL = `/upload/settings/${action.env}`;
|
||||
const response = yield [
|
||||
const response = yield all([
|
||||
call(request, requestURL, { method: 'GET' }),
|
||||
call(request, '/upload/environments', { method: 'GET' }),
|
||||
];
|
||||
]);
|
||||
|
||||
yield put(getSettingsSucceeded(response[0], response[1].environments));
|
||||
} catch(err) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
||||
import { Map } from 'immutable';
|
||||
import { isEmpty } from 'lodash';
|
||||
import { call, fork, put, select, take, takeLatest } from 'redux-saga/effects';
|
||||
import { all, call, fork, put, select, take, takeLatest } from 'redux-saga/effects';
|
||||
import request from 'utils/request';
|
||||
|
||||
import {
|
||||
@ -44,10 +44,10 @@ function* dataGet() {
|
||||
_sort: pageParams._sort,
|
||||
_start,
|
||||
};
|
||||
const data = yield [
|
||||
const data = yield all([
|
||||
call(request, '/upload/files', { method: 'GET', params }),
|
||||
call(request, '/upload/files/count', { method: 'GET' }),
|
||||
];
|
||||
]);
|
||||
const entries = data[0].length === 0 ? [] : data[0].map(obj => Map(obj));
|
||||
yield put(getDataSuccess(entries, data[1].count));
|
||||
} catch(err) {
|
||||
|
||||
@ -94,4 +94,4 @@
|
||||
},
|
||||
"preferGlobal": true,
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user