Changed from Alert to Toast to work well with mui v18

This commit is contained in:
Frikky
2023-08-17 03:16:43 +02:00
parent 1461d6ad6b
commit 99d1a96c63
36 changed files with 553 additions and 542 deletions
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from "react";
import theme from '../theme.jsx';
import { v4 as uuidv4 } from "uuid";
import { useAlert } from "react-alert";
import { toast } from 'react-toastify';
import {
Divider,
@@ -44,7 +44,7 @@ const AuthenticationData = (props) => {
authFieldsOnly,
} = props
const alert = useAlert()
//const alert = useAlert()
let navigate = useNavigate();
const [submitSuccessful, setSubmitSuccessful] = useState(false)
const [authenticationOption, setAuthenticationOptions] = React.useState({
@@ -99,9 +99,9 @@ const AuthenticationData = (props) => {
.then((responseJson) => {
if (!responseJson.success) {
if (responseJson.reason === undefined) {
alert.error("Failed to set app auth. Are you logged in?")
toast("Failed to set app auth. Are you logged in?")
} else {
alert.error("Failed to set app auth: " + responseJson.reason);
toast("Failed to set app auth: " + responseJson.reason);
}
} else {
setSubmitSuccessful(true)
@@ -115,7 +115,7 @@ const AuthenticationData = (props) => {
}
})
.catch((error) => {
//alert.error(error.toString());
//toast(error.toString());
console.log("New auth error: ", error.toString());
});
};
@@ -175,7 +175,7 @@ const AuthenticationData = (props) => {
selectedApp.authentication.parameters[paramkey].name
] = "false";
} else {
alert.info(
toast(
"Field " +
selectedApp.authentication.parameters[paramkey].name +
" can't be empty"