From 19a4b8b43ce044c652e5e4e5061dec3a6efd3152 Mon Sep 17 00:00:00 2001 From: Dm1tr1y147 Date: Wed, 23 Sep 2020 20:45:19 +0500 Subject: [PATCH] Added card successfull upload message --- src/views/Admin/UploadForm/index.tsx | 10 +++++----- src/views/Admin/types.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/views/Admin/UploadForm/index.tsx b/src/views/Admin/UploadForm/index.tsx index b12c6a9..3c1a7b3 100644 --- a/src/views/Admin/UploadForm/index.tsx +++ b/src/views/Admin/UploadForm/index.tsx @@ -17,9 +17,7 @@ type props = { const UploadForm: React.FC = ({ setLoading, token }) => { const { push: historyPush } = useHistory(); - const [errorStatus, setErrorStatus] = useState({ - successful: true - }); + const [errorStatus, setErrorStatus] = useState({}); useEffect(() => { if (!token) { @@ -31,7 +29,7 @@ const UploadForm: React.FC = ({ setLoading, token }) => {
{ - setErrorStatus({ successful: true }); + setErrorStatus({}); handleFormSubmit( e, 'api/card/create', @@ -75,7 +73,9 @@ const UploadForm: React.FC = ({ setLoading, token }) => { - {!errorStatus.successful ? ( + {errorStatus.successful ? ( +

Успешно загружено

+ ) : errorStatus.successful === false ? (

{errorStatus.errorMessage}

) : ( '' diff --git a/src/views/Admin/types.ts b/src/views/Admin/types.ts index 1d7cb1c..272cf5a 100644 --- a/src/views/Admin/types.ts +++ b/src/views/Admin/types.ts @@ -1,5 +1,5 @@ interface IErrorStatus { - successful: boolean; + successful?: boolean; errorMessage?: string; }