Move api routes to /api and add /api/sessions

This commit is contained in:
2021-04-21 17:38:47 +02:00
parent 5fa1819bea
commit 5c43bb409e
12 changed files with 66 additions and 9 deletions

View File

@ -8,7 +8,7 @@
<a href="/history">tillbaka</a>
<br>
<br>
<form action="/session/{{session_id}}/edit" method="post">
<form action="/api/session/{{session_id}}/edit" method="post">
<input type="hidden" id="category" name="category" value="{{session.category}}">
<input type="hidden" id="deleted" name="deleted" value="{{session.deleted}}">
<span>Started:</span>
@ -20,7 +20,7 @@
<button type="submit">spara</button>
</form>
<br>
<form action="/session/{{this.session_id}}/delete" method="post">
<form action="/api/session/{{this.session_id}}/delete" method="post">
<button type="submit">ta bort</button>
</form>
</div>

View File

@ -12,10 +12,10 @@
// Get the corresponding route to activate/inactivate the category
let url;
if(active) {
url = "/category/" + id + "/end_session";
url = "/api/category/" + id + "/end_session";
cl.remove(toggled_class);
} else {
url = "/category/" + id + "/start_session";
url = "/api/category/" + id + "/start_session";
cl.add(toggled_class);
}
@ -40,7 +40,7 @@
></div>
<span class="category_name">{{this.1.name}}</span>
{{#if this.1.started}}
<form action="/category/{{this.0}}/bump_session/minutes/5", method="post">
<form action="/api/category/{{this.0}}/bump_session/minutes/5", method="post">
<button style="height: 100%; color: green;" type="submit">+5</button>
</form>
{{/if}}

View File

@ -4,7 +4,7 @@
<body>
<h1 class="title">stl</h1>
<h2>Logga in</h2>
<form action="/login" method="post">
<form action="/api/login" method="post">
<input type="password" id="password" name="password"></input>
</form>
</body>