-
Notifications
You must be signed in to change notification settings - Fork 0
/
HomePage.jsx
32 lines (28 loc) · 1.04 KB
/
HomePage.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import React, { useState, useEffect } from 'react';
import * as gs from "genericsuite";
const authenticationService = gs.authenticationService.authenticationService;
const console_debug_log = gs.loggingService.console_debug_log;
const debug = false;
export const HomePage = ({ children }) => {
if (debug) console_debug_log('>>>> genericsuite-fe-ai HomePage <<<<');
const [currentUser, setCurrentUser] = useState(authenticationService.currentUserValue);
useEffect(() => {
const subscription = authenticationService.currentUser.subscribe(
x => setCurrentUser(x)
);
return () => subscription.unsubscribe();
}, []);
return (
<gs.HomePage>
<>
{!currentUser &&
(<p><a href="/#/login">Please Sign-in</a></p>)
}
{currentUser &&
(<p>Hi {currentUser.firstName}! Welcome to the GenericSuite AI (frontend version)</p>)
}
</>
{children}
</gs.HomePage>
);
}