mirror of
https://github.com/strapi/strapi.git
synced 2025-11-14 01:02:04 +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
|
<Formik
|
||||||
initialValues={{ code: defaultOption.label, displayName: defaultOption.value }}
|
initialValues={{ code: defaultOption.label, displayName: defaultOption.value }}
|
||||||
onSubmit={values =>
|
onSubmit={values =>
|
||||||
addLocale({ code: values.code, name: values.displayName }).then(onClose)}
|
addLocale({ code: values.code, name: values.displayName, isDefault: false }).then(onClose)}
|
||||||
validationSchema={localeFormSchema}
|
validationSchema={localeFormSchema}
|
||||||
>
|
>
|
||||||
{({ handleSubmit, errors }) => (
|
{({ handleSubmit, errors }) => (
|
||||||
|
|||||||
@ -2,13 +2,14 @@ import { request } from 'strapi-helper-plugin';
|
|||||||
import { useMutation, useQueryClient } from 'react-query';
|
import { useMutation, useQueryClient } from 'react-query';
|
||||||
import { getTrad } from '../../utils';
|
import { getTrad } from '../../utils';
|
||||||
|
|
||||||
const addLocale = async ({ code, name }) => {
|
const addLocale = async ({ code, name, isDefault }) => {
|
||||||
try {
|
try {
|
||||||
const data = await request(`/i18n/locales`, {
|
const data = await request(`/i18n/locales`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: {
|
body: {
|
||||||
name,
|
name,
|
||||||
code,
|
code,
|
||||||
|
isDefault,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user