Skip to content
Snippets Groups Projects
Commit 01ffdedb authored by Maiken Louise's avatar Maiken Louise
Browse files

Task 3 done

parents 2ed3e11c 794a6583
No related branches found
No related tags found
No related merge requests found
Pipeline #115179 passed
package resources;
<<<<<<< HEAD
=======
>>>>>>> 794a6583a949557859a601f9399dfb3bbf0def40
import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
......@@ -12,7 +15,6 @@ import javax.ws.rs.core.MediaType;
*/
@Path("/calculator")
public class CalculatorResource {
/**
* Method handling HTTP POST requests. The calculated answer to the expression will be sent to the client as
* plain/text.
......@@ -47,7 +49,7 @@ public int calculate(String expression) {
return result;
}
//Multiplication
public int multiplication(String equation) {
String[] split = equation.split("[*]");
int sum = Integer.parseInt(split[0]);
......
......@@ -15,6 +15,7 @@
</div>
<form class="main" id="loginForm" onsubmit="login(event)">
<input class="loginInput" placeholder="Brukernavn..." id="username" required pattern="([\w]+)">
<input class="loginInput" type="password" placeholder="Passord..." id="password" required pattern="([\w]+)">
<button class="loginBtn">Logg inn</button>
</form>
</div>
......
......@@ -15,7 +15,8 @@ inputfield.addEventListener("input",function () {
function login(event){
event.preventDefault();
let user = {
"username": document.getElementById('username').value
"username": document.getElementById('username').value,
"password": document.getElementById('password').value
};
fetch('../api/user', {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment