added Login page for testing with BE endpoint

This commit is contained in:
Hoang Pham 2021-12-13 14:04:41 -06:00
parent 3b257fe3cb
commit 583a0293ce
7 changed files with 44 additions and 1 deletions

View file

@ -354,7 +354,7 @@ func (h *Handler) collectStats(next http.Handler) http.Handler {
// latticeRoutes lists the frontend routes that do not directly correspond to
// backend routes, and require special handling.
var latticeRoutes = []string{"/tables", "/query", "/querybuilder"} // TODO somehow pull this from some metadata in the lattice directory
var latticeRoutes = []string{"/tables", "/query", "/querybuilder", "/login"} // TODO somehow pull this from some metadata in the lattice directory
// newRouter creates a new mux http router.
func newRouter(handler *Handler) http.Handler {

View file

@ -11,6 +11,7 @@ import { MoleculaTablesContainer } from 'App/MoleculaTables';
import { QueryContainer } from 'App/Query';
import { QueryBuilderContainer } from 'App/QueryBuilder';
import css from './App.module.scss';
import Login from 'App/Login/Login';
const App = () => {
const [theme, setTheme] = useState<string>(
@ -46,6 +47,7 @@ const App = () => {
<Route path="/tables/:id?" component={MoleculaTablesContainer} />
<Route exact path="/query" component={QueryContainer} />
<Route exact path="/querybuilder" component={QueryBuilderContainer} />
<Route exact path="/login" component={Login} />
<Route component={NotFound} />
</Switch>
</div>

View file

@ -0,0 +1,19 @@
import LoginButton from './LoginButton';
import { pilosa } from 'services/eventServices';
function login() {
pilosa.get.login().then((res) => {
console.log(`login result:`, res);
});
}
function Login() {
return (
<>
<h6>Login</h6>
<LoginButton onClick={login} />
</>
);
}
export default Login;

View file

@ -0,0 +1,11 @@
import React from 'react';
interface Props {
onClick: () => void;
}
const LoginButton: React.FC<Props> = ({ onClick }) => {
return <button onClick={onClick}>Login</button>;
};
export default LoginButton;

View file

@ -0,0 +1 @@
export * from './Login';

View file

@ -14,6 +14,9 @@ export const pilosa = {
status() {
return api.get('/status');
},
login() {
return api.get('/login');
},
info() {
return api.get('/info');
},

View file

@ -51,6 +51,13 @@ export const Nav = () => {
</Typography>
</ListItem>
</NavLink>
<NavLink to="/login" activeClassName={css.activeNavLink}>
<ListItem className={css.navLink} button>
<Typography variant="subtitle2" color={textColor}>
Login
</Typography>
</ListItem>
</NavLink>
</List>
</div>
);