mirror of
https://github.com/strapi/strapi.git
synced 2025-11-02 02:44:55 +00:00
Merge pull request #9418 from strapi/fix/api-params
[i18n] fixing add locale params
This commit is contained in:
commit
a2d922daae
@ -40,7 +40,7 @@ const ModalCreate = ({ onClose, isOpened }) => {
|
||||
<Formik
|
||||
initialValues={{ code: defaultOption.label, displayName: defaultOption.value }}
|
||||
onSubmit={values =>
|
||||
addLocale({ code: values.code, name: values.displayName }).then(onClose)}
|
||||
addLocale({ code: values.code, name: values.displayName, isDefault: false }).then(onClose)}
|
||||
validationSchema={localeFormSchema}
|
||||
>
|
||||
{({ handleSubmit, errors }) => (
|
||||
|
||||
@ -2,13 +2,14 @@ import { request } from 'strapi-helper-plugin';
|
||||
import { useMutation, useQueryClient } from 'react-query';
|
||||
import { getTrad } from '../../utils';
|
||||
|
||||
const addLocale = async ({ code, name }) => {
|
||||
const addLocale = async ({ code, name, isDefault }) => {
|
||||
try {
|
||||
const data = await request(`/i18n/locales`, {
|
||||
method: 'POST',
|
||||
body: {
|
||||
name,
|
||||
code,
|
||||
isDefault,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user