import { Button, Paper, TextField } from "@mui/material"; import { observer } from "mobx-react-lite"; import { ArrowLeft, Save } from "lucide-react"; import { Loader2 } from "lucide-react"; import { useNavigate } from "react-router-dom"; import { toast } from "react-toastify"; import { countryStore, languageStore } from "@shared"; import { useState } from "react"; import { LanguageSwitcher } from "@widgets"; export const CountryCreatePage = observer(() => { const navigate = useNavigate(); const [isLoading, setIsLoading] = useState(false); const { language } = languageStore; const { createCountryData, setCountryData, createCountry } = countryStore; const handleCreate = async () => { try { setIsLoading(true); await createCountry(); toast.success("Страна успешно создана"); navigate("/country"); } catch (error) { toast.error("Ошибка при создании страны"); } finally { setIsLoading(false); } }; return (

{createCountryData.ru.name}

setCountryData( e.target.value, createCountryData[language].name, language ) } /> setCountryData(createCountryData.code, e.target.value, language) } />
); });