Fakultas Ilmu Komputer UI

Commit 99e67356 authored by FadhilP's avatar FadhilP
Browse files

[REFACTOR] Reallocate error

parent 1f7de3bb
......@@ -9,7 +9,7 @@ import {
} from "../../component/html/html";
import { css } from "@emotion/core";
const FormBank = ({ onSubmit, initialData = null }) => {
const FormBank = ({ onSubmit, initialData = null, error }) => {
const { register, handleSubmit, errors } = useForm({
defaultValues:
initialData !== null
......@@ -70,7 +70,15 @@ const FormBank = ({ onSubmit, initialData = null }) => {
<ErrorDiv>Nama pemilik rekening tidak boleh kosong</ErrorDiv>
)}
</RowInput>
<RowInput>
{error && (
<ErrorDiv>
<button className="btn btn-danger">
Error !, Data tidak dapat disimpan
</button>
</ErrorDiv>
)}
</RowInput>
<RowInput>
<InputSubmitForm
type="submit"
......
......@@ -33,10 +33,6 @@ const TambahBank = () => {
flex-direction: column;
`}
>
<div>
{error && <ErrorDiv>Error !, Data tidak dapat disimpan</ErrorDiv>}
</div>
<div
css={css`
font-style: normal;
......@@ -57,7 +53,7 @@ const TambahBank = () => {
TAMBAH BANK
</div>
</div>
<FormBank {...{ onSubmit }} />
<FormBank {...{ onSubmit, error }} />
</div>
);
};
......
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