diff --git a/examples/device-dashboard/net.c b/examples/device-dashboard/net.c index f93c3ceb..03b85bc3 100644 --- a/examples/device-dashboard/net.c +++ b/examples/device-dashboard/net.c @@ -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")) { diff --git a/examples/device-dashboard/web_root/main.js b/examples/device-dashboard/web_root/main.js index efa5f68d..34213343 100644 --- a/examples/device-dashboard/web_root/main.js +++ b/examples/device-dashboard/web_root/main.js @@ -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));