mirror of
https://gitlab.nic.cz/turris/reforis/foris-js.git
synced 2025-06-16 13:46:16 +02:00
Display actual error within the form.
This commit is contained in:
@ -27,7 +27,6 @@ export default function ResetWiFiSettings({ ws, endpoint }) {
|
||||
const module = "wifi";
|
||||
ws.subscribe(module)
|
||||
.bind(module, "reset", () => {
|
||||
setIsLoading(true);
|
||||
// eslint-disable-next-line no-restricted-globals
|
||||
setTimeout(() => location.reload(), 1000);
|
||||
});
|
||||
@ -45,6 +44,7 @@ export default function ResetWiFiSettings({ ws, endpoint }) {
|
||||
|
||||
function onReset() {
|
||||
dismissAlert();
|
||||
setIsLoading(true);
|
||||
postReset();
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,10 @@ describe("<WiFiSettings/>", () => {
|
||||
it("should handle error", async () => {
|
||||
const webSockets = new WebSockets();
|
||||
const { getByText } = render(<WiFiSettings ws={webSockets} ws={webSockets} endpoint={endpoint} resetEndpoint="foo" />);
|
||||
mockJSONError();
|
||||
const errorMessage = "An API error occurred.";
|
||||
mockJSONError(errorMessage);
|
||||
await wait(() => {
|
||||
expect(getByText("An error occurred while fetching data.")).toBeTruthy();
|
||||
expect(getByText(errorMessage)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user