Skip to content

Commit 2679206

Browse files
committed
fix
1 parent b2f6118 commit 2679206

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

www-data/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<form name="form" action="#">
99
<p><label for="author">Автор: </label><input type="text" id="author" name="author" required></p>
1010
<p><label for="text">Текст: </label><textarea rows="30" cols="100" id="text" name="text"></textarea></p>
11-
<input type="submit" onclick="onSend()">
11+
<input type="button" value="Submit" onclick="onSend()">
1212
</form>
1313
<span id="latest">unchanged</span>
1414
<script src="../r/index.js"></script>

www-data/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fetch("../api/v1/latest")
1+
fetch("/api/v1/latest")
22
.then(function (response) {
33
return response.json();
44
})
@@ -18,15 +18,15 @@ function onSend() {
1818
const author = document.forms["form"].author.value;
1919
const text = document.forms["form"].text.value;
2020

21-
fetch("../api/v1/posts?author=" + author, {
21+
fetch("/api/v1/posts?author=" + author, {
2222
method: "POST",
2323
body: text,
2424
})
2525
.then(function(response) {
2626
return response.json();
2727
})
2828
.then(function(json) {
29-
document.location = '../' + json['uuid'];
29+
document.location.href = '/' + json['uuid'];
3030
})
3131
.catch(function (error) {
3232
alert(error);

www-data/text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function get_text_id() {
66
}
77

88
function fetch_text_by_id(id) {
9-
return fetch("../api/v1/posts/" + id);
9+
return fetch("/api/v1/posts/" + id);
1010
}
1111

1212
function setup_text() {

0 commit comments

Comments
 (0)