|
|
@ -12,11 +12,14 @@ import LoginForm from "./components/LoginForm";
|
|
|
|
|
|
|
|
|
|
|
|
import { login } from "./store/actions";
|
|
|
|
import { login } from "./store/actions";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import * as Etebase from "etebase";
|
|
|
|
|
|
|
|
|
|
|
|
import * as C from "./constants";
|
|
|
|
import * as C from "./constants";
|
|
|
|
|
|
|
|
|
|
|
|
import SignedPagesBadge from "./images/signed-pages-badge.svg";
|
|
|
|
import SignedPagesBadge from "./images/signed-pages-badge.svg";
|
|
|
|
import { useCredentials } from "./credentials";
|
|
|
|
import { useCredentials } from "./credentials";
|
|
|
|
import LoadingIndicator from "./widgets/LoadingIndicator";
|
|
|
|
import LoadingIndicator from "./widgets/LoadingIndicator";
|
|
|
|
|
|
|
|
import { startTask } from "./helpers";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export default function LoginGate() {
|
|
|
|
export default function LoginGate() {
|
|
|
@ -29,11 +32,17 @@ export default function LoginGate() {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
setLoading(true);
|
|
|
|
setLoading(true);
|
|
|
|
setFetchError(undefined);
|
|
|
|
setFetchError(undefined);
|
|
|
|
const ret = login(username, password, serviceApiUrl);
|
|
|
|
const etebase = await startTask((async () => {
|
|
|
|
await ret.payload;
|
|
|
|
return await Etebase.Account.login(username, password, serviceApiUrl);
|
|
|
|
dispatch(ret);
|
|
|
|
}));
|
|
|
|
|
|
|
|
dispatch(login(etebase));
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
setFetchError(e);
|
|
|
|
console.log(e);
|
|
|
|
|
|
|
|
if ((e instanceof Etebase.HTTPError) && (e.status === 404)) {
|
|
|
|
|
|
|
|
setFetchError(new Error("Etebase server not found: are you sure the server URL is correct?"));
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
setFetchError(e);
|
|
|
|
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
setLoading(false);
|
|
|
|
setLoading(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|