input validations
This commit is contained in:
parent
fc6b316396
commit
8e9f2715ba
|
|
@ -15,7 +15,7 @@ import { SourceEditDataType } from "../types/sources";
|
||||||
const CreateSource = () => {
|
const CreateSource = () => {
|
||||||
const { setSources } = useContext<ContextType>(PostContext).sourceValue;
|
const { setSources } = useContext<ContextType>(PostContext).sourceValue;
|
||||||
const { popup, setPopup } = useContext<ContextType>(PostContext).popupValue;
|
const { popup, setPopup } = useContext<ContextType>(PostContext).popupValue;
|
||||||
const navigate = useNavigate();
|
// const navigate = useNavigate();
|
||||||
const [data, setData] = useState<SourceEditDataType>({
|
const [data, setData] = useState<SourceEditDataType>({
|
||||||
name: "",
|
name: "",
|
||||||
source: "",
|
source: "",
|
||||||
|
|
@ -28,7 +28,7 @@ const CreateSource = () => {
|
||||||
<IconContext.Provider value={{ color: "#8DD77F" }}>
|
<IconContext.Provider value={{ color: "#8DD77F" }}>
|
||||||
<FaRegPlusSquare />
|
<FaRegPlusSquare />
|
||||||
</IconContext.Provider>
|
</IconContext.Provider>
|
||||||
<h1>Source</h1>
|
<h1>Create source</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form
|
<form
|
||||||
|
|
@ -62,6 +62,7 @@ const CreateSource = () => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
disabled={!(data.name.length > 0 && data.source.length > 0)}
|
||||||
className="source-edit__submit"
|
className="source-edit__submit"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
createLink(() => {}, data);
|
createLink(() => {}, data);
|
||||||
|
|
|
||||||
|
|
@ -110,6 +110,7 @@ const EditSource = () => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
disabled={!(data.name.length > 0 && data.source.length > 0)}
|
||||||
className="source-edit__submit"
|
className="source-edit__submit"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
updateLink(() => {}, id ? parseInt(id) : 0, data);
|
updateLink(() => {}, id ? parseInt(id) : 0, data);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue