mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-28 20:58:31 +00:00
event table POST request 404 error
This commit is contained in:
1 parent
c63135ec7f
commit
8f19ee7b97
2 files changed
+4
-4
No files matched your search
@@ -180,7 +180,7 @@ static size_t print_events(void (*out)(char, void *), void *ptr, va_list *ap) {
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_events_get(struct mg_connection *c, struct mg_http_message *hm) {
|
static void handle_events_set(struct mg_connection *c, struct mg_http_message *hm) {
|
||||||
int pageno = mg_json_get_long(hm->body, "$.page", 1);
|
int pageno = mg_json_get_long(hm->body, "$.page", 1);
|
||||||
mg_http_reply(c, 200, s_json_header, "{%m:[%M], %m:%d}", MG_ESC("arr"),
|
mg_http_reply(c, 200, s_json_header, "{%m:[%M], %m:%d}", MG_ESC("arr"),
|
||||||
print_events, pageno, MG_ESC("totalCount"), MAX_EVENTS_NO);
|
print_events, pageno, MG_ESC("totalCount"), MAX_EVENTS_NO);
|
||||||
@@ -237,8 +237,8 @@ static void fn(struct mg_connection *c, int ev, void *ev_data, void *fn_data) {
|
|||||||
handle_debug(c, hm);
|
handle_debug(c, hm);
|
||||||
} else if (mg_http_match_uri(hm, "/api/stats/get")) {
|
} else if (mg_http_match_uri(hm, "/api/stats/get")) {
|
||||||
handle_stats_get(c);
|
handle_stats_get(c);
|
||||||
} else if (mg_http_match_uri(hm, "/api/events/get")) {
|
} else if (mg_http_match_uri(hm, "/api/events/set")) {
|
||||||
handle_events_get(c, hm);
|
handle_events_set(c, hm);
|
||||||
} else if (mg_http_match_uri(hm, "/api/settings/get")) {
|
} else if (mg_http_match_uri(hm, "/api/settings/get")) {
|
||||||
handle_settings_get(c);
|
handle_settings_get(c);
|
||||||
} else if (mg_http_match_uri(hm, "/api/settings/set")) {
|
} else if (mg_http_match_uri(hm, "/api/settings/set")) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ function Events({}) {
|
|||||||
const [page, setPage] = useState(1);
|
const [page, setPage] = useState(1);
|
||||||
|
|
||||||
const refresh = () =>
|
const refresh = () =>
|
||||||
fetch('/api/events/get', {
|
fetch('/api/events/set', {
|
||||||
method: 'POST', body: JSON.stringify({page: page}),
|
method: 'POST', body: JSON.stringify({page: page}),
|
||||||
}).then(r => r.json())
|
}).then(r => r.json())
|
||||||
.then(r => setEvents(r));
|
.then(r => setEvents(r));
|
||||||
|
|||||||
Reference in new issue
Block a user