fix(tabsContext.tsx): handle error message properly when saving changes in the tabs provider

The error handling in the tabs provider has been improved to display a more meaningful error message when there is an error while saving changes. Instead of directly assigning the error to the `setErrorData` state variable, the error message is now wrapped in an object with a title and a list of error messages. This change ensures that the error message is displayed consistently and provides better context to the user.
This commit is contained in:
anovazzi1 2023-08-24 19:50:17 -03:00
commit 9b3e4f27a5

View file

@ -30,6 +30,7 @@ import {
import { getRandomDescription, getRandomName } from "../utils/utils";
import { alertContext } from "./alertContext";
import { typesContext } from "./typesContext";
import { AxiosError } from "axios";
const uid = new ShortUniqueId({ length: 5 });
@ -602,7 +603,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
});
}
} catch (err) {
setErrorData(err as errorsVarType);
setErrorData({title: "Error while saving changes",list:[(err as AxiosError).message]});
}
}