Fakultas Ilmu Komputer UI

Commit e8dad180 authored by FadhilP's avatar FadhilP
Browse files

[REFACTOR] Add error alert above submit button

parent fd4c1d56
......@@ -15,7 +15,7 @@ import { useState } from "react";
import DateTime from 'react-datetime';
import "react-datetime/css/react-datetime.css";
const FormProgram = ({ onSubmit, initialData = null }) => {
const FormProgram = ({ onSubmit, initialData = null, error }) => {
const { register, handleSubmit, errors } = useForm({
defaultValues:
initialData !== null
......@@ -271,6 +271,15 @@ const FormProgram = ({ onSubmit, initialData = null }) => {
ref={register}
/>
</RowInput>
<RowInput>
{error && (
<ErrorDiv>
<button className="btn btn-danger">
Error !, Data tidak dapat disimpan
</button>
</ErrorDiv>
)}
</RowInput>
<RowInput>
<InputSubmitForm type="submit" data-testid="submit-program" />
</RowInput>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment