mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 10:55:37 +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;
|
||||
background-color: ${({ theme }) => theme.main.colors.lightestBlue};
|
||||
background-color: ${theme.main.colors.lightestBlue};
|
||||
${Text} {
|
||||
color: ${theme.main.colors.mediumBlue};
|
||||
}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { useHistory } from 'react-router-dom';
|
||||
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 PropTypes from 'prop-types';
|
||||
import {
|
||||
@ -28,6 +28,7 @@ import { getRequestUrl } from './utils';
|
||||
const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug, id, origin }) => {
|
||||
const { emitEvent } = useGlobalContext();
|
||||
const { push, replace } = useHistory();
|
||||
const [{ rawQuery }] = useQueryParams();
|
||||
const dispatch = useDispatch();
|
||||
const {
|
||||
componentsDataStructure,
|
||||
@ -212,7 +213,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, from, slug, id, or
|
||||
|
||||
const onPost = useCallback(
|
||||
async (body, trackerProperty) => {
|
||||
const endPoint = getRequestUrl(slug);
|
||||
const endPoint = `${getRequestUrl(slug)}${rawQuery}`;
|
||||
|
||||
try {
|
||||
// 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
|
||||
dispatch(setStatus('resolved'));
|
||||
|
||||
replace(`/plugins/${pluginId}/collectionType/${slug}/${response.id}`);
|
||||
replace(`/plugins/${pluginId}/collectionType/${slug}/${response.id}${rawQuery}`);
|
||||
} catch (err) {
|
||||
emitEventRef.current('didNotCreateEntry', { error: err, trackerProperty });
|
||||
displayErrors(err);
|
||||
dispatch(setStatus('resolved'));
|
||||
}
|
||||
},
|
||||
[cleanReceivedData, displayErrors, replace, slug, dispatch]
|
||||
[cleanReceivedData, displayErrors, replace, slug, dispatch, rawQuery]
|
||||
);
|
||||
|
||||
const onPublish = useCallback(async () => {
|
||||
|
||||
@ -21,7 +21,7 @@ const EditViewLayoutManager = ({ layout, ...rest }) => {
|
||||
};
|
||||
}, [layout, dispatch, query]);
|
||||
|
||||
if (!currentLayout) {
|
||||
if (!currentLayout || !permissions) {
|
||||
return <LoadingIndicatorPage />;
|
||||
}
|
||||
|
||||
|
||||
@ -11,8 +11,8 @@ const useSyncRbac = (query, collectionTypeUID, containerName = 'listView') => {
|
||||
const relatedPermissions = collectionTypesRelatedPermissions[collectionTypeUID];
|
||||
|
||||
useEffect(() => {
|
||||
if (query && relatedPermissions) {
|
||||
dispatch(setPermissions(relatedPermissions, query.plugins, containerName));
|
||||
if (relatedPermissions) {
|
||||
dispatch(setPermissions(relatedPermissions, query ? query.plugins : null, containerName));
|
||||
|
||||
return () => {
|
||||
dispatch(resetPermissions());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user