event table POST request 404 error

This commit is contained in:
robert committed 2023-06-23 11:35:42 -04:00
1 parent c63135ec7f
commit 8f19ee7b97
2 files changed
+4 -4

No files matched your search

+3 -3
View File
@@ -180,7 +180,7 @@ static size_t print_events(void (*out)(char, void *), void *ptr, va_list *ap) {
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);
mg_http_reply(c, 200, s_json_header, "{%m:[%M], %m:%d}", MG_ESC("arr"),
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);
} else if (mg_http_match_uri(hm, "/api/stats/get")) {
handle_stats_get(c);
} else if (mg_http_match_uri(hm, "/api/events/get")) {
handle_events_get(c, hm);
} else if (mg_http_match_uri(hm, "/api/events/set")) {
handle_events_set(c, hm);
} else if (mg_http_match_uri(hm, "/api/settings/get")) {
handle_settings_get(c);
} else if (mg_http_match_uri(hm, "/api/settings/set")) {
+1 -1
View File
@@ -55,7 +55,7 @@ function Events({}) {
const [page, setPage] = useState(1);
const refresh = () =>
fetch('/api/events/get', {
fetch('/api/events/set', {
method: 'POST', body: JSON.stringify({page: page}),
}).then(r => r.json())
.then(r => setEvents(r));