Minor bug fixes and CI change.
This commit is contained in:
@@ -12,7 +12,7 @@ const ErrorBoundaryFallback: React.FC<FallbackProps> = ({
|
||||
return (
|
||||
<Result
|
||||
status={"500"}
|
||||
title={t("app.errors.errorboundary")}
|
||||
title={t("errors.errorboundary")}
|
||||
subTitle={error?.message}
|
||||
extra={[
|
||||
<Button key="try-again" onClick={resetErrorBoundary}>
|
||||
|
||||
@@ -73,7 +73,7 @@ const SettingsWatcher: React.FC = () => {
|
||||
|
||||
return (
|
||||
<Card title={t("settings.labels.watcherstatus")}>
|
||||
<Space>
|
||||
<Space wrap>
|
||||
{isWatcherStarted ? (
|
||||
<Button onClick={handleStop}>
|
||||
{t("settings.actions.stopwatcher")}
|
||||
@@ -100,7 +100,7 @@ const SettingsWatcher: React.FC = () => {
|
||||
checkedChildren={t("settings.labels.watchermoderealtime")}
|
||||
unCheckedChildren={t("settings.labels.watchermodepolling")}
|
||||
/>
|
||||
<Space size="small">
|
||||
<Space size="small" wrap>
|
||||
<span>{t("settings.labels.pollinginterval")}</span>
|
||||
<InputNumber
|
||||
title={t("settings.labels.pollinginterval")}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { auth } from "@renderer/util/firebase";
|
||||
import type { FormProps } from "antd";
|
||||
import { Alert, Button, Form, Input } from "antd";
|
||||
import { Alert, Button, Form, Input, Space } from "antd";
|
||||
import log from "electron-log/renderer";
|
||||
import { signInWithEmailAndPassword } from "firebase/auth";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import errorTypeCheck from "../../../../util/errorTypeCheck";
|
||||
import ipcTypes from "../../../../util/ipcTypes.json";
|
||||
|
||||
type FieldType = {
|
||||
username: string;
|
||||
@@ -15,15 +16,19 @@ type FieldType = {
|
||||
|
||||
const SignInForm: React.FC = () => {
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [loading, setLoading] = useState<boolean>(false);
|
||||
const { t } = useTranslation();
|
||||
const onFinish: FormProps<FieldType>["onFinish"] = async (values) => {
|
||||
const { username, password } = values;
|
||||
setLoading(true);
|
||||
try {
|
||||
const result = await signInWithEmailAndPassword(auth, username, password);
|
||||
log.debug("Login result", result);
|
||||
} catch (error) {
|
||||
log.error("Login error", errorTypeCheck(error));
|
||||
setError(t("auth.login.error"));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -59,18 +64,27 @@ const SignInForm: React.FC = () => {
|
||||
<Input.Password />
|
||||
</Form.Item>
|
||||
<Form.Item label={null}>
|
||||
<Button type="primary" htmlType="submit">
|
||||
{t("auth.login.login")}
|
||||
</Button>
|
||||
<Space>
|
||||
<Button type="primary" loading={loading} htmlType="submit">
|
||||
{t("auth.login.login")}
|
||||
</Button>
|
||||
<Button
|
||||
onClick={(): void => {
|
||||
window.electron.ipcRenderer.send(
|
||||
ipcTypes.toMain.user.resetPassword,
|
||||
);
|
||||
}}
|
||||
>
|
||||
{t("auth.login.resetpassword")}
|
||||
</Button>
|
||||
</Space>
|
||||
</Form.Item>
|
||||
{error && (
|
||||
<Form.Item label={null}>
|
||||
<Alert message={error} type="error" />
|
||||
</Form.Item>
|
||||
)}
|
||||
<Form.Item label={null}>
|
||||
<Button>{t("auth.login.resetpassword")}</Button>
|
||||
</Form.Item>
|
||||
<Form.Item label={null}></Form.Item>
|
||||
</Form>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -12,6 +12,8 @@ import {
|
||||
import store from "@renderer/redux/redux-store";
|
||||
import ipcTypes from "../../../util/ipcTypes.json";
|
||||
import { auth } from "./firebase";
|
||||
import { notification } from "antd";
|
||||
import i18n from "./i18n";
|
||||
|
||||
const ipcRenderer = window.electron.ipcRenderer;
|
||||
const dispatch = store.dispatch;
|
||||
@@ -74,3 +76,13 @@ ipcRenderer.on(
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
ipcRenderer.on(
|
||||
ipcTypes.toRenderer.general.showErrorMessage,
|
||||
(_event: Electron.IpcRendererEvent, error) => {
|
||||
notification.error({
|
||||
message: i18n.t("errors.notificationtitle"),
|
||||
description: error,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user