+
diff --git a/rsconcept/frontend/src/pages/RSFormCreatePage.tsx b/rsconcept/frontend/src/pages/RSFormCreatePage.tsx
index 58785616..d76d7aef 100644
--- a/rsconcept/frontend/src/pages/RSFormCreatePage.tsx
+++ b/rsconcept/frontend/src/pages/RSFormCreatePage.tsx
@@ -11,6 +11,7 @@ import { useNavigate } from 'react-router-dom';
import TextArea from '../components/Common/TextArea';
import Checkbox from '../components/Common/Checkbox';
import FileInput from '../components/Common/FileInput';
+import { toast } from 'react-toastify';
function RSFormCreatePage() {
const navigate = useNavigate();
@@ -29,8 +30,11 @@ function RSFormCreatePage() {
}
}
- const onSuccess = (newID: string) => navigate(`/rsforms/${newID}`);
- const { createNew, error, setError, loading } = useNewRSForm({callback: onSuccess})
+ const onSuccess = (newID: string) => {
+ toast.success('Схема успешно создана');
+ navigate(`/rsforms/${newID}`);
+ }
+ const { createSchema, error, setError, loading } = useNewRSForm()
useEffect(() => {
setError(undefined)
@@ -45,7 +49,11 @@ function RSFormCreatePage() {
'comment': comment,
'is_common': common,
};
- createNew({data: data, file: file});
+ createSchema({
+ data: data,
+ file: file,
+ onSuccess: onSuccess
+ });
}
};
diff --git a/rsconcept/frontend/src/pages/RSFormPage/RSFormCard.tsx b/rsconcept/frontend/src/pages/RSFormPage/RSFormCard.tsx
index 1e83808d..8c1ad3db 100644
--- a/rsconcept/frontend/src/pages/RSFormPage/RSFormCard.tsx
+++ b/rsconcept/frontend/src/pages/RSFormPage/RSFormCard.tsx
@@ -6,10 +6,10 @@ import TextInput from '../../components/Common/TextInput';
import { useRSForm } from '../../context/RSFormContext';
import { useCallback, useEffect, useState } from 'react';
import Button from '../../components/Common/Button';
-import { CrownIcon, DownloadIcon, DumpBinIcon, UploadIcon } from '../../components/Icons';
+import { CrownIcon, DownloadIcon, DumpBinIcon } from '../../components/Icons';
import { useUsers } from '../../context/UsersContext';
import { useNavigate } from 'react-router-dom';
-import FileInput from '../../components/Common/FileInput';
+import { toast } from 'react-toastify';
function RSFormCard() {
const navigate = useNavigate();
@@ -21,8 +21,6 @@ function RSFormCard() {
const [alias, setAlias] = useState('');
const [comment, setComment] = useState('');
const [common, setCommon] = useState(false);
-
- const onSuccess = (data: any) => reload();
useEffect(() => {
setTitle(schema!.title)
@@ -40,28 +38,34 @@ function RSFormCard() {
'comment': comment,
'is_common': common,
};
- upload(data, onSuccess);
+ upload(data, () => {
+ toast.success('Изменения сохранены');
+ reload();
+ });
}
};
const handleDelete = useCallback(() => {
if (window.confirm('Вы уверены, что хотите удалить данную схему?')) {
- destroy(() => navigate('/rsforms?filter=owned'))
+ destroy(() => {
+ toast.success('Схема удалена');
+ navigate('/rsforms?filter=owned');
+ });
}
}, [destroy, navigate]);
const handleClaimOwner = useCallback(() => {
if (window.confirm('Вы уверены, что хотите стать владельцем данной схемы?')) {
- claim(() => reload());
+ claim(() => {
+ toast.success('Вы стали владельцем схемы');
+ reload();
+ });
}
}, [claim, reload]);
- const handleUpload = useCallback(() => {
-
- }, []);
-
const handleDownload = useCallback(() => {
-
+ // TODO: implement file download
+ toast.info('Загрузка в разработке');
}, []);
return (
diff --git a/rsconcept/frontend/src/pages/RegisterPage.tsx b/rsconcept/frontend/src/pages/RegisterPage.tsx
index d9133a18..1fcf8441 100644
--- a/rsconcept/frontend/src/pages/RegisterPage.tsx
+++ b/rsconcept/frontend/src/pages/RegisterPage.tsx
@@ -40,11 +40,11 @@ function RegisterPage() {
};
return (
- <>
+
{ success &&
-
+
}
{ !success && user &&
}
@@ -90,7 +90,7 @@ function RegisterPage() {
{ error &&
}
}
- >
+
);
}