import React, { Suspense } from 'react' import { Head, router, useForm } from '@inertiajs/react' import AuthenticatedLayout from '@/Layouts/AuthenticatedLayout' import FormInput from '@/Components/FormInput' import Button from '@/Components/Button' import { extractValue } from './utils' const TinyEditor = React.lazy(() => import('@/Components/TinyMCE')) export default function General(props) { const { setting } = props const { data, setData, post, reset, processing, errors } = useForm({ OPEN_WEBSITE_NAME: extractValue(setting, 'OPEN_WEBSITE_NAME'), SHARE_TEXT: extractValue(setting, 'SHARE_TEXT'), }) const handleOnChange = (event) => { setData( event.target.name, event.target.type === 'checkbox' ? event.target.checked ? 1 : 0 : event.target.value ) } const handleSubmit = () => { post(route('setting.update'), { onSuccess: () => { setTimeout(() => router.get(route(route().current())), 3000) }, }) } return (
Setting
General
Loading...
}> { setData( 'SHARE_TEXT', editor.getContent() ) }} />
) }