Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve error message #45

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions EnterAccountDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ import PropTypes from "prop-types";
import {useTranslation} from "react-i18next";

const EnterAccountDetails = ({onClose, onAdd, validateSecret}) => {
EnterAccountDetails.propTypes = {
onClose: PropTypes.func.isRequired,
onAdd: PropTypes.func.isRequired,
validateSecret: PropTypes.func.isRequired,
};

const {notify} = useNotifications();
const {t} = useTranslation();
const [accountName, setAccountName] = useState("");
Expand Down Expand Up @@ -55,16 +49,20 @@ const EnterAccountDetails = ({onClose, onAdd, validateSecret}) => {

if (accountName.trim() === "" || secretKey.trim() === "") {
notify("error", {
title: t("common.error"),
description: t("editAccount.Please fill in all the fields!"),
params: {
title: t("common.error"),
description: t("editAccount.Please fill in all the fields!"),
},
});
return;
}

if (secretError) {
notify("error", {
title: t("common.error"),
description: t("editAccount.Invalid Secret Key"),
params: {
title: t("common.error"),
description: t("editAccount.Invalid Secret Key"),
},
});
return;
}
Expand Down Expand Up @@ -166,6 +164,12 @@ const EnterAccountDetails = ({onClose, onAdd, validateSecret}) => {
);
};

EnterAccountDetails.propTypes = {
onClose: PropTypes.func.isRequired,
onAdd: PropTypes.func.isRequired,
validateSecret: PropTypes.func.isRequired,
};

const styles = {
container: {
flex: 1,
Expand Down
Loading