2 Commits

Author SHA1 Message Date
0b87b82a4d Initial commit for management 2023-01-19 10:05:47 -05:00
61d3db113b Merge pull request #11 from jslightham/Update-package-json
Update package-lock.json
2023-01-15 21:07:05 -05:00
4 changed files with 217 additions and 0 deletions

1
public/consts.js Normal file
View File

@@ -0,0 +1 @@
const backendURL = "http://127.0.0.1:8080";

73
public/index.html Normal file
View File

@@ -0,0 +1,73 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<center>
<h1>Kno-Logic Management Portal</h1>
<form>
<table border="black">
<th colspan="2">
Login
</th>
<tr>
<td>
<label for="email">Email: </label>
</td>
<td>
<input type="text" id="email" name="email">
</td>
</tr>
<tr>
<td>
<label for="password">Password: </label>
</td>
<td>
<input type="password" id="password" name="password">
</td>
</tr>
<tr>
<td colspan="2">
<center><button type="button" onclick="login()">Login</button></center>
</td>
</tr>
<tr>
<td colspan="2">
<a href="/manage/register.html">Register</a>
</td>
</tr>
</table>
</form>
</center>
</body>
<script src="./consts.js"></script>
<script>
function login() {
let email = document.getElementById("email").value;
let password = document.getElementById("password").value;
(async () => {
const rawResponse = await fetch(backendURL + '/v1/user/login', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ email: email, password: password })
});
const content = await rawResponse.text();
console.log(content);
})();
}
</script>
</html>

59
public/manageHome.html Normal file
View File

@@ -0,0 +1,59 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<center>
<h1>Kno-Logic Management Portal</h1>
<table border="black">
<th colspan="4">
Home
</th>
<tr>
<td>
<a href="/manage/manageHome.html">Home</a>
</td>
<td>
<a href="/manage/managePosts.html">Manage Posts</a>
</td>
<td>
<a href="/manage/manageCategories.html">Manage Categories</a>
</td>
<td>
<a href="/manage/manageHome.html">Analytics</a>
</td>
</tr>
</table>
</center>
</body>
<script src="./consts.js"></script>
<script>
function login() {
let email = document.getElementById("email").value;
let password = document.getElementById("password").value;
(async () => {
const rawResponse = await fetch(backendURL + '/v1/user/login', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ email: email, password: password })
});
const content = await rawResponse.text();
console.log(content);
})();
}
</script>
</html>

84
public/register.html Normal file
View File

@@ -0,0 +1,84 @@
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<center>
<h1>Kno-Logic Management Portal</h1>
<form>
<table border="black">
<th colspan="2">
Register
</th>
<tr>
<td>
<label for="email">Name: </label>
</td>
<td>
<input type="text" id="name" name="name">
</td>
</tr>
<tr>
<td>
<label for="email">Email: </label>
</td>
<td>
<input type="email" id="email" name="email">
</td>
</tr>
<tr>
<td>
<label for="password">Password: </label>
</td>
<td>
<input type="password" id="password" name="password">
</td>
</tr>
<tr>
<td colspan="2">
<center><button type="button" onclick="login()">Login</button></center>
</td>
</tr>
<tr>
<td colspan="2">
<a href="/manage/index.html">Log In</a>
</td>
</tr>
</table>
</form>
</center>
</body>
<script src="./consts.js"></script>
<script>
function login() {
let name = document.getElementById("name").value;
let email = document.getElementById("email").value;
let password = document.getElementById("password").value;
(async () => {
const rawResponse = await fetch(backendURL + '/v1/user/create', {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({ name: name, email: email, password: password })
});
const content = await rawResponse.text();
alert(content);
console.log(content);
})();
}
</script>
</html>