diff --git a/client/pages/adminpage/logger.js b/client/pages/adminpage/logger.js index 1ba7cc5c..6178ec72 100644 --- a/client/pages/adminpage/logger.js +++ b/client/pages/adminpage/logger.js @@ -1,5 +1,5 @@ import React, { useState, useEffect, useRef } from "react"; -import { FormBuilder, Loader, Button, Icon } from "../../components/"; +import { FormBuilder, Loader, Button } from "../../components/"; import { Config, Log } from "../../model/"; import { FormObjToJSON, notify, format, nop } from "../../helpers/"; import { t } from "../../locales/"; @@ -12,14 +12,14 @@ export function LogPage({ isSaving = nop }) { const [config, setConfig] = useState({}); const $log = useRef(); const filename = () => { - const t = new Date().toISOString().substring(0,10).replace(/-/g, ""); + const t = new Date().toISOString().substring(0, 10).replace(/-/g, ""); return `access_${t}.log`; }; const onChange = (r) => { - const c = Object.assign({}, config) + const c = Object.assign({}, config); c["log"] = r[""]["params"]; c["connections"] = window.CONFIG.connections; - delete c["constant"] + delete c["constant"]; isSaving(true); Config.save(c, true, () => { isSaving(false); @@ -31,7 +31,7 @@ export function LogPage({ isSaving = nop }) { const fetchLogs = () => { Log.get(1024*100).then((log) => { // get only the last 100kb of log setLog(log + "\n\n\n\n\n"); - if($log.current.scrollTop === 0) { + if ($log.current.scrollTop === 0) { $log.current.scrollTop = $log.current.scrollHeight; } }).catch((err) => { @@ -41,18 +41,18 @@ export function LogPage({ isSaving = nop }) { useEffect(() => { Config.all().then((config) => { - setForm({"":{"params":config["log"]}}); + setForm({ "": { "params": config["log"] } }); setConfig(FormObjToJSON(config)); }); fetchLogs(); const id = setInterval(fetchLogs, 5000); - return () => clearInterval(id) + return () => clearInterval(id); }, []); return (

Logging

-
+
{ format(struct.label) }: -
+
{ $input }
-
+
{ - struct.description ? (
{struct.description}
) : null + struct.description && ( +
{struct.description}
+ ) }
)} />
-
+            
                 { log === "" ?  : log }
             
); diff --git a/client/pages/homepage.js b/client/pages/homepage.js index 3ec87cc2..e1b4ccda 100644 --- a/client/pages/homepage.js +++ b/client/pages/homepage.js @@ -10,10 +10,10 @@ export function HomePage() { useEffect(() => { Session.currentUser().then((res) => { if (res && res.is_authenticated === true) { - setRedirection(res.home ? "/files" + res.home : "/files"); - } else { - setRedirection("/login"); + setRedirection(res.home ? `/files${res.home}` : "/files"); + return; } + setRedirection("/login"); }).catch((err) => setRedirection("/login")); }, []); diff --git a/client/pages/logout.js b/client/pages/logout.js index 3cbded19..8cd12240 100644 --- a/client/pages/logout.js +++ b/client/pages/logout.js @@ -4,24 +4,19 @@ import { Session } from "../model/"; import { Loader, ErrorPage } from "../components/"; import { cache } from "../helpers/"; -@ErrorPage -export class LogoutPage extends React.Component { - constructor(props){ - super(props); - } - - componentDidMount(){ +function LogoutPageComponent({ error, history }) { + useEffect(() => { Session.logout().then((res) => { cache.destroy(); - CONFIG["logout"] ? + window.CONFIG["logout"] ? location.href = CONFIG["logout"] : - this.props.history.push("/"); - }).catch((err) => this.props.error(err)); - } + history.push("/"); + }).catch((err) => error(err)); + }, []); - render() { - return ( -
- ); - } + return ( +
+ ); } + +export const LogoutPage = ErrorPage(LogoutPageComponent);