mirror of
https://github.com/strapi/strapi.git
synced 2025-11-17 18:51:22 +00:00
Merge pull request #9741 from strapi/i18n/cm-post-locales
[I18n] Post single locale
This commit is contained in:
commit
df66ea8a4d
@ -20,7 +20,7 @@ const Wrapper = styled.div`
|
|||||||
`
|
`
|
||||||
: `
|
: `
|
||||||
border: 1px solid #A5D5FF;
|
border: 1px solid #A5D5FF;
|
||||||
background-color: ${({ theme }) => theme.main.colors.lightestBlue};
|
background-color: ${theme.main.colors.lightestBlue};
|
||||||
${Text} {
|
${Text} {
|
||||||
color: ${theme.main.colors.mediumBlue};
|
color: ${theme.main.colors.mediumBlue};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
import { useHistory } from 'react-router-dom';
|
import { useHistory } from 'react-router-dom';
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
import { request, useGlobalContext } from 'strapi-helper-plugin';
|
import { request, useGlobalContext, useQueryParams } from 'strapi-helper-plugin';
|
||||||
import { useSelector, useDispatch } from 'react-redux';
|
import { useSelector, useDispatch } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {
|
import {
|
||||||
@ -28,6 +28,7 @@ import { getRequestUrl } from './utils';
|
|||||||
const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug, id, origin }) => {
|
const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug, id, origin }) => {
|
||||||
const { emitEvent } = useGlobalContext();
|
const { emitEvent } = useGlobalContext();
|
||||||
const { push, replace } = useHistory();
|
const { push, replace } = useHistory();
|
||||||
|
const [{ rawQuery }] = useQueryParams();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const {
|
const {
|
||||||
componentsDataStructure,
|
componentsDataStructure,
|
||||||
@ -212,7 +213,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug, id, or
|
|||||||
|
|
||||||
const onPost = useCallback(
|
const onPost = useCallback(
|
||||||
async (body, trackerProperty) => {
|
async (body, trackerProperty) => {
|
||||||
const endPoint = getRequestUrl(slug);
|
const endPoint = `${getRequestUrl(slug)}${rawQuery}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Show a loading button in the EditView/Header.js && lock the app => no navigation
|
// Show a loading button in the EditView/Header.js && lock the app => no navigation
|
||||||
@ -230,14 +231,14 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug, id, or
|
|||||||
// Enable navigation and remove loaders
|
// Enable navigation and remove loaders
|
||||||
dispatch(setStatus('resolved'));
|
dispatch(setStatus('resolved'));
|
||||||
|
|
||||||
replace(`/plugins/${pluginId}/collectionType/${slug}/${response.id}`);
|
replace(`/plugins/${pluginId}/collectionType/${slug}/${response.id}${rawQuery}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
emitEventRef.current('didNotCreateEntry', { error: err, trackerProperty });
|
emitEventRef.current('didNotCreateEntry', { error: err, trackerProperty });
|
||||||
displayErrors(err);
|
displayErrors(err);
|
||||||
dispatch(setStatus('resolved'));
|
dispatch(setStatus('resolved'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[cleanReceivedData, displayErrors, replace, slug, dispatch]
|
[cleanReceivedData, displayErrors, replace, slug, dispatch, rawQuery]
|
||||||
);
|
);
|
||||||
|
|
||||||
const onPublish = useCallback(async () => {
|
const onPublish = useCallback(async () => {
|
||||||
|
|||||||
@ -21,7 +21,7 @@ const EditViewLayoutManager = ({ layout, ...rest }) => {
|
|||||||
};
|
};
|
||||||
}, [layout, dispatch, query]);
|
}, [layout, dispatch, query]);
|
||||||
|
|
||||||
if (!currentLayout) {
|
if (!currentLayout || !permissions) {
|
||||||
return <LoadingIndicatorPage />;
|
return <LoadingIndicatorPage />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,8 @@ const useSyncRbac = (query, collectionTypeUID, containerName = 'listView') => {
|
|||||||
const relatedPermissions = collectionTypesRelatedPermissions[collectionTypeUID];
|
const relatedPermissions = collectionTypesRelatedPermissions[collectionTypeUID];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (query && relatedPermissions) {
|
if (relatedPermissions) {
|
||||||
dispatch(setPermissions(relatedPermissions, query.plugins, containerName));
|
dispatch(setPermissions(relatedPermissions, query ? query.plugins : null, containerName));
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
dispatch(resetPermissions());
|
dispatch(resetPermissions());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user