mirror of https://git.sr.ht/~garritfra/omega
Garrit Franke
4 years ago
13 changed files with 132 additions and 28 deletions
@ -0,0 +1,11 @@
|
||||
const router = require("express").Router(); |
||||
|
||||
router.get("/login", (req, res) => { |
||||
res.render("Login"); |
||||
}); |
||||
|
||||
router.get("/register", (req, res) => { |
||||
res.render("Register"); |
||||
}); |
||||
|
||||
module.exports = router; |
@ -1,7 +1,23 @@
|
||||
const router = require("express").Router(); |
||||
const axios = require("axios"); |
||||
|
||||
router.get("/", (req, res) => { |
||||
res.render("Clients"); |
||||
const basePath = process.env.API_BASE_PATH; |
||||
|
||||
router.get("/", async (req, res) => { |
||||
console.debug(basePath); |
||||
const clients = await axios.get( |
||||
basePath + "/clients", |
||||
{}, |
||||
{ headers: { Authorization: "Bearer " + req.token } } |
||||
); |
||||
console.log(clients); |
||||
|
||||
res.render("Clients", { |
||||
clients: [ |
||||
{ id: 1, name: "Foo Bar" }, |
||||
{ id: 2, name: "Michael Jackson" }, |
||||
], |
||||
}); |
||||
}); |
||||
|
||||
module.exports = router; |
||||
|
@ -0,0 +1,7 @@
|
||||
const router = require("express").Router(); |
||||
|
||||
router.get("/", (req, res) => { |
||||
res.render("Landing"); |
||||
}); |
||||
|
||||
module.exports = router; |
@ -1,10 +1,32 @@
|
||||
import React from "react"; |
||||
import Layout from "./layouts/Main"; |
||||
|
||||
export default function Clients() { |
||||
export default function Clients({ clients }) { |
||||
const clientViews = clients.map((client) => { |
||||
return ( |
||||
<a |
||||
href={"/clients/" + client.id} |
||||
className="list-group-item list-group-item-action" |
||||
> |
||||
{client.name} |
||||
</a> |
||||
); |
||||
}); |
||||
|
||||
return ( |
||||
<Layout> |
||||
<h1>Clients</h1> |
||||
<div className="row"> |
||||
<div className="col-4"> |
||||
<a href="/clients/new"> |
||||
<button onClick="console.log('asd')" className="btn btn-primary"> |
||||
New Client |
||||
</button> |
||||
</a> |
||||
</div> |
||||
<div className="col-8"> |
||||
<div className="list-group">{clientViews}</div> |
||||
</div> |
||||
</div> |
||||
</Layout> |
||||
); |
||||
} |
||||
|
@ -0,0 +1,11 @@
|
||||
import React from "react"; |
||||
import Layout from "./layouts/Main"; |
||||
|
||||
export default function Index() { |
||||
return ( |
||||
<Layout> |
||||
<a href="/auth/login">Login</a> |
||||
<a href="/auth/register">Register</a> |
||||
</Layout> |
||||
); |
||||
} |
@ -0,0 +1,10 @@
|
||||
import React from "react"; |
||||
import Layout from "./layouts/Main"; |
||||
|
||||
export default function Index() { |
||||
return ( |
||||
<Layout> |
||||
<div>Login</div> |
||||
</Layout> |
||||
); |
||||
} |
@ -0,0 +1,10 @@
|
||||
import React from "react"; |
||||
import Layout from "./layouts/Main"; |
||||
|
||||
export default function Index() { |
||||
return ( |
||||
<Layout> |
||||
<div>Register here</div> |
||||
</Layout> |
||||
); |
||||
} |
Loading…
Reference in new issue