From fde9a300b6352a688a6fc9cac07aa75305088801 Mon Sep 17 00:00:00 2001 From: r1m199 Date: Thu, 16 Apr 2026 21:41:20 +0300 Subject: [PATCH 1/3] fixed the email reg toast and deleted unused imports --- src/api/controllers/auth/decorators.ts | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/api/controllers/auth/decorators.ts b/src/api/controllers/auth/decorators.ts index 8f0791d..fb936ac 100644 --- a/src/api/controllers/auth/decorators.ts +++ b/src/api/controllers/auth/decorators.ts @@ -1,10 +1,12 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -import { ApiError } from '@/api'; +//import { ApiError } from '@/api'; import { apiClient } from '../../client'; import { ToastType } from '@/models'; import router from '@/router'; import { useProfileStore } from '@/store/profile'; import { useToastStore } from '@/store/toast'; +//import { error } from 'console'; +//import { toRaw } from 'vue'; type Func = (...args: FuncArgs) => R; type Decorator = Func< @@ -37,17 +39,22 @@ export function scoped( export function showErrorToast( method: F -): Func>, Parameters> { +): Func | null }>, Parameters> { return async (...args: any[]) => { const toastStore = useToastStore(); try { const response = await method(...args); - return response; - } catch (err) { - const error = err as ApiError; + if ('error' in response) { + const errormessage = response.error?.detail?.[0].msg; + throw new Error(errormessage); + } else { + return response; + } + } catch (err: any) { + const error = err?.detail?.[0] ?? err; if (error) { toastStore.push({ - title: error.ru ?? error.message, + title: error.ru ?? error.msg ?? error, type: ToastType.Error, }); } else { @@ -57,6 +64,7 @@ export function showErrorToast( type: ToastType.Error, }); } + return { error: err, response: null }; } }; } From 9aeab80db4b94920f7d264f9e33aa6fbb50b8da1 Mon Sep 17 00:00:00 2001 From: r1m199 Date: Thu, 16 Apr 2026 21:45:39 +0300 Subject: [PATCH 2/3] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BC=D0=BC=D0=B5=D0=BD=D1=82=D0=B0=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/controllers/auth/decorators.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/api/controllers/auth/decorators.ts b/src/api/controllers/auth/decorators.ts index fb936ac..f4a98f8 100644 --- a/src/api/controllers/auth/decorators.ts +++ b/src/api/controllers/auth/decorators.ts @@ -1,12 +1,10 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ -//import { ApiError } from '@/api'; + import { apiClient } from '../../client'; import { ToastType } from '@/models'; import router from '@/router'; import { useProfileStore } from '@/store/profile'; import { useToastStore } from '@/store/toast'; -//import { error } from 'console'; -//import { toRaw } from 'vue'; type Func = (...args: FuncArgs) => R; type Decorator = Func< From 6022fd70e1b4c5e12660339cb5c5b90dbd1d42c8 Mon Sep 17 00:00:00 2001 From: r1m199 Date: Thu, 16 Apr 2026 21:58:54 +0300 Subject: [PATCH 3/3] =?UTF-8?q?=D1=83=D0=B1=D1=80=D0=B0=D0=BB=20=D0=BB?= =?UTF-8?q?=D0=B8=D1=88=D0=BD=D1=8E=D1=8E=20=D0=BF=D1=83=D1=81=D1=82=D1=83?= =?UTF-8?q?=D1=8E=20=D1=81=D1=82=D1=80=D0=BE=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/controllers/auth/decorators.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/api/controllers/auth/decorators.ts b/src/api/controllers/auth/decorators.ts index f4a98f8..9690509 100644 --- a/src/api/controllers/auth/decorators.ts +++ b/src/api/controllers/auth/decorators.ts @@ -1,5 +1,4 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ - import { apiClient } from '../../client'; import { ToastType } from '@/models'; import router from '@/router';