fix: executing validation twice should display 2 errors (#13670)

This commit is contained in:
Barthélémy Ledoux
2025-12-15 14:02:37 +01:00
committed by GitHub
parent 048dcb80cc
commit ba1d6b2232
3 changed files with 15 additions and 9 deletions

View File

@@ -11,7 +11,7 @@
title?: string;
message?: string;
content?: {
message: string;
message?: string;
_embedded?: {
errors?: any[];
};
@@ -19,8 +19,8 @@
response?: {
status: number;
config: {
url: string;
method: string;
url?: string;
method?: string;
};
};
variant?: "success" | "warning" | "info" | "error" | "primary";
@@ -97,8 +97,8 @@
if (props.message.response) {
error.error.response = {};
error.error.request = {
method: props.message.response.config.method,
url: props.message.response.config.url,
method: props.message.response.config.method ?? "GET",
url: props.message.response.config.url ?? "unknown url",
};
if (props.message.response.status) {
@@ -111,7 +111,11 @@
notifications.value = ElNotification({
title: title.value || "Error",
message: h(ErrorToastContainer, {
message: props.message,
message: {
content:{
message: props.message?.content?.message ?? ""
}
},
items: items.value,
onClose: () => close()
}),

View File

@@ -192,6 +192,7 @@
if (formRef && this.flowCanBeExecuted) {
this.checks = [];
this.executeClicked = false;
this.coreStore.message = null;
formRef.validate((valid) => {
if (!valid) {
return false;

View File

@@ -7,6 +7,7 @@ import {useCoreStore} from "../stores/core"
import * as BasicAuth from "../utils/basicAuth"
import {useAuthStore} from "override/stores/auth"
import {useMiscStore} from "override/stores/misc";
import {useUnsavedChangesStore} from "../stores/unsavedChanges"
let pendingRoute = false
let requestsTotal = 0
@@ -97,7 +98,7 @@ export const createAxios = (
const coreStore = useCoreStore()
coreStore.message = {
variant: "error",
response: errorResponse,
response: errorResponse.response,
content: errorResponse,
}
return Promise.reject(errorResponse)
@@ -149,7 +150,7 @@ export const createAxios = (
toRefreshQueue = []
document.body.classList.add("login")
useCoreStore().unsavedChange = false
useUnsavedChangesStore().unsavedChange = false
useLayoutStore().setTopNavbar(undefined)
BasicAuth.logout()
delete instance.defaults.headers.common["Authorization"]
@@ -211,7 +212,7 @@ export const createAxios = (
toRefreshQueue = []
document.body.classList.add("login")
useCoreStore().unsavedChange = false
useUnsavedChangesStore().unsavedChange = false
useLayoutStore().setTopNavbar(undefined)
BasicAuth.logout()
delete instance.defaults.headers.common["Authorization"]