Merge pull request #7716 from strapi/fix/7699

Fixes Admin bugs
This commit is contained in:
Alexandre BODIN 2020-09-24 14:41:10 +02:00 committed by GitHub
commit c97f33bf53
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 26 additions and 10 deletions

View File

@ -20,6 +20,7 @@ const Register = ({
formErrors,
inputsPrefix,
modifiedData,
noSignin,
onChange,
onSubmit,
requestError,
@ -135,15 +136,17 @@ const Register = ({
</Box>
</Padded>
</Section>
<AuthLink label="Auth.link.signin" to="/auth/login">
<Text fontSize="md">
{formatMessage({ id: 'Auth.link.signin.account' })}
&nbsp;
<Text fontSize="md" color="#0097f7" as="span">
{formatMessage({ id: 'Auth.link.signin' })}
{!noSignin && (
<AuthLink label="Auth.link.signin" to="/auth/login">
<Text fontSize="md">
{formatMessage({ id: 'Auth.link.signin.account' })}
&nbsp;
<Text fontSize="md" color="#0097f7" as="span">
{formatMessage({ id: 'Auth.link.signin' })}
</Text>
</Text>
</Text>
</AuthLink>
</AuthLink>
)}
</>
);
};
@ -151,6 +154,7 @@ const Register = ({
Register.defaultProps = {
fieldsToDisable: [],
inputsPrefix: '',
noSignin: false,
onSubmit: e => e.preventDefault(),
requestError: null,
};
@ -160,6 +164,7 @@ Register.propTypes = {
formErrors: PropTypes.object.isRequired,
inputsPrefix: PropTypes.string,
modifiedData: PropTypes.object.isRequired,
noSignin: PropTypes.bool,
onChange: PropTypes.func.isRequired,
onSubmit: PropTypes.func,
requestError: PropTypes.object,

View File

@ -22,7 +22,7 @@ const AuthPage = ({ hasAdmin }) => {
} = useRouteMatch('/auth/:authType');
const query = useQuery();
const registrationToken = query.get('registrationToken');
const { Component, endPoint, fieldsToDisable, fieldsToOmit, inputsPrefix, schema } = get(
const { Component, endPoint, fieldsToDisable, fieldsToOmit, inputsPrefix, schema, ...rest } = get(
forms,
authType,
{}
@ -285,6 +285,7 @@ const AuthPage = ({ hasAdmin }) => {
</NavTopRightWrapper>
<BaselineAlignment top size="78px">
<Component
{...rest}
fieldsToDisable={fieldsToDisable}
formErrors={formErrors}
inputsPrefix={inputsPrefix}

View File

@ -80,6 +80,7 @@ const forms = {
'register-admin': {
Component: Register,
endPoint: 'register-admin',
noSignin: true,
fieldsToDisable: [],
fieldsToOmit: ['confirmPassword', 'news'],
schema: yup.object().shape({

View File

@ -21,6 +21,7 @@ const CustomTable = ({ canUpdate, canDelete, data, headers, isBulkable, showLoad
emitEvent('willEditEntryFromList');
push({
pathname: `${pathname}/${id}`,
state: { from: pathname },
});
};

View File

@ -159,6 +159,14 @@ const EditViewDataManagerProvider = ({
console.log(err);
const status = get(err, 'response.status', null);
// The record does not exists
// Redirect the user to the previous page
if (id && status === 404) {
push(from);
return;
}
if (id && status === 403) {
strapi.notification.info(getTrad('permissions.not-allowed.update'));

View File

@ -53,7 +53,7 @@ const HomePageSettings = ({
placeholder={formatMessage({ id: getTrad('search.placeholder') })}
name="_q"
value={searchValue}
autoFocus="true"
autoFocus
/>
{isLoading ? (
<>