Fix dashboard not showing data bug

This commit is contained in:
turtled 2017-09-25 14:59:58 +08:00
parent 16eef90707
commit d9f14dacaf
2 changed files with 8 additions and 8 deletions

View File

@ -26,7 +26,7 @@
-import(proplists, [get_value/2, get_value/3]).
-export([http_handler/0, handle_request/2, http_api/0]).
-export([http_handler/0, handle_request/2, http_api/0, inner_handle_request/2]).
-include("emqttd_internal.hrl").
@ -54,14 +54,14 @@ handle_request(Req, State) ->
"/api/v2/auth" ->
handle_request(Path, Req, State);
_ ->
Host = Req:get_header_value("Host"),
[_, Port] = string:tokens(Host, ":"),
case Port of
"18083" -> handle_request(Path, Req, State);
_ -> if_authorized(Req, fun() -> handle_request(Path, Req, State) end)
end
if_authorized(Req, fun() -> handle_request(Path, Req, State) end)
end.
inner_handle_request(Req, State) ->
Path = Req:get(path),
handle_request(Path, Req, State).
handle_request("/api/v2/" ++ Url, Req, #state{dispatch = Dispatch}) ->
Dispatch(Req, Url);

View File

@ -25,7 +25,7 @@
-http_api({"^nodes/(.+?)/clients/(.+?)/?$", 'GET',client_list, []}).
-http_api({"^clients/(.+?)/?$", 'GET', client, []}).
-http_api({"^clients/(.+?)/?$", 'DELETE', kick_client, []}).
-http_api({"^clients/(.+?)/clean_acl_cache?$", 'DELETE', clean_acl_cache, [{<<"topic">>, binary}]}).
-http_api({"^clients/(.+?)/clean_acl_cache?$", 'PUT', clean_acl_cache, [{<<"topic">>, binary}]}).
-http_api({"^routes?$", 'GET', route_list, []}).
-http_api({"^routes/(.+?)/?$", 'GET', route, []}).