@@ -269,3 +276,37 @@ function RSTabs() {
}
export default RSTabs;
+
+// ====== Internals =========
+function ProcessError({
+ error,
+ isArchive,
+ itemID
+}: {
+ error: ErrorData;
+ isArchive: boolean;
+ itemID: string;
+}): React.ReactElement {
+ if (axios.isAxiosError(error) && error.response) {
+ if (error.response.status === 404) {
+ return (
+
+
{`Схема с указанным идентификатором ${isArchive ? 'и версией ' : ''}отсутствует`}
+
+
+ {isArchive ?
: null}
+ {isArchive ?
: null}
+
+
+ );
+ } else if (error.response.status === 403) {
+ return (
+
+
Владелец ограничил доступ к данной схеме
+
+
+ );
+ }
+ }
+ return ;
+}
diff --git a/rsconcept/frontend/src/pages/RegisterPage.tsx b/rsconcept/frontend/src/pages/RegisterPage.tsx
index 1fadf108..ecf60832 100644
--- a/rsconcept/frontend/src/pages/RegisterPage.tsx
+++ b/rsconcept/frontend/src/pages/RegisterPage.tsx
@@ -25,24 +25,6 @@ import { HelpTopic } from '@/models/miscellaneous';
import { IUserSignupData } from '@/models/user';
import { globals, patterns } from '@/utils/constants';
-function ProcessError({ error }: { error: ErrorData }): React.ReactElement {
- if (axios.isAxiosError(error) && error.response && error.response.status === 400) {
- if ('email' in error.response.data) {
- return (
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- {error.response.data.email}.
- );
- } else {
- return (
-
- );
- }
- }
- return ;
-}
-
function RegisterPage() {
const router = useConceptNavigation();
const { user, signup, loading, error, setError } = useAuth();
@@ -203,3 +185,22 @@ function RegisterPage() {
}
export default RegisterPage;
+
+// ====== Internals =========
+function ProcessError({ error }: { error: ErrorData }): React.ReactElement {
+ if (axios.isAxiosError(error) && error.response && error.response.status === 400) {
+ if ('email' in error.response.data) {
+ return (
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ {error.response.data.email}.
+ );
+ } else {
+ return (
+
+ );
+ }
+ }
+ return ;
+}
diff --git a/rsconcept/frontend/src/pages/RestorePasswordPage.tsx b/rsconcept/frontend/src/pages/RestorePasswordPage.tsx
index 5bb74b94..beaef1f0 100644
--- a/rsconcept/frontend/src/pages/RestorePasswordPage.tsx
+++ b/rsconcept/frontend/src/pages/RestorePasswordPage.tsx
@@ -12,14 +12,6 @@ import AnimateFade from '@/components/wrap/AnimateFade';
import { useAuth } from '@/context/AuthContext';
import { IRequestPasswordData } from '@/models/user';
-function ProcessError({ error }: { error: ErrorData }): React.ReactElement {
- if (axios.isAxiosError(error) && error.response && error.response.status === 400) {
- return Данный email не используется на Портале.
;
- } else {
- return ;
- }
-}
-
function RestorePasswordPage() {
const { requestPasswordReset, loading, error, setError } = useAuth();
@@ -73,3 +65,12 @@ function RestorePasswordPage() {
}
export default RestorePasswordPage;
+
+// ====== Internals =========
+function ProcessError({ error }: { error: ErrorData }): React.ReactElement {
+ if (axios.isAxiosError(error) && error.response && error.response.status === 400) {
+ return Данный email не используется на Портале.
;
+ } else {
+ return ;
+ }
+}
diff --git a/rsconcept/frontend/src/pages/UserProfilePage/EditorPassword.tsx b/rsconcept/frontend/src/pages/UserProfilePage/EditorPassword.tsx
index 07df7f73..890a7972 100644
--- a/rsconcept/frontend/src/pages/UserProfilePage/EditorPassword.tsx
+++ b/rsconcept/frontend/src/pages/UserProfilePage/EditorPassword.tsx
@@ -14,14 +14,6 @@ import { useAuth } from '@/context/AuthContext';
import { useConceptNavigation } from '@/context/NavigationContext';
import { IUserUpdatePassword } from '@/models/user';
-function ProcessError({ error }: { error: ErrorData }): React.ReactElement {
- if (axios.isAxiosError(error) && error.response && error.response.status === 400) {
- return Неверно введен старый пароль
;
- } else {
- return ;
- }
-}
-
function EditorPassword() {
const router = useConceptNavigation();
const { updatePassword, error, setError, loading } = useAuth();
@@ -109,3 +101,12 @@ function EditorPassword() {
}
export default EditorPassword;
+
+// ====== Internals =========
+function ProcessError({ error }: { error: ErrorData }): React.ReactElement {
+ if (axios.isAxiosError(error) && error.response && error.response.status === 400) {
+ return Неверно введен старый пароль
;
+ } else {
+ return ;
+ }
+}
diff --git a/rsconcept/frontend/src/pages/UserProfilePage/EditorProfile.tsx b/rsconcept/frontend/src/pages/UserProfilePage/EditorProfile.tsx
index bc94bc93..4b06b5aa 100644
--- a/rsconcept/frontend/src/pages/UserProfilePage/EditorProfile.tsx
+++ b/rsconcept/frontend/src/pages/UserProfilePage/EditorProfile.tsx
@@ -12,18 +12,6 @@ import { useBlockNavigation } from '@/context/NavigationContext';
import { useUserProfile } from '@/context/UserProfileContext';
import { IUserUpdateData } from '@/models/user';
-function ProcessError({ error }: { error: ErrorData }): React.ReactElement {
- if (axios.isAxiosError(error) && error.response && error.response.status === 400) {
- if ('email' in error.response.data) {
- return (
- // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
- {error.response.data.email}.
- );
- }
- }
- return ;
-}
-
function EditorProfile() {
const { updateUser, user, errorProcessing, processing } = useUserProfile();
@@ -106,3 +94,16 @@ function EditorProfile() {
}
export default EditorProfile;
+
+// ====== Internals =========
+function ProcessError({ error }: { error: ErrorData }): React.ReactElement {
+ if (axios.isAxiosError(error) && error.response && error.response.status === 400) {
+ if ('email' in error.response.data) {
+ return (
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
+ {error.response.data.email}.
+ );
+ }
+ }
+ return ;
+}