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:
parent
cea8acacd8
commit
9b3e4f27a5
1 changed files with 2 additions and 1 deletions
|
|
@ -30,6 +30,7 @@ import {
|
||||||
import { getRandomDescription, getRandomName } from "../utils/utils";
|
import { getRandomDescription, getRandomName } from "../utils/utils";
|
||||||
import { alertContext } from "./alertContext";
|
import { alertContext } from "./alertContext";
|
||||||
import { typesContext } from "./typesContext";
|
import { typesContext } from "./typesContext";
|
||||||
|
import { AxiosError } from "axios";
|
||||||
|
|
||||||
const uid = new ShortUniqueId({ length: 5 });
|
const uid = new ShortUniqueId({ length: 5 });
|
||||||
|
|
||||||
|
|
@ -602,7 +603,7 @@ export function TabsProvider({ children }: { children: ReactNode }) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setErrorData(err as errorsVarType);
|
setErrorData({title: "Error while saving changes",list:[(err as AxiosError).message]});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue