Skip to content

Commit e4693a8

Browse files
committed
http_app_token: minor update
1 parent 1b51d05 commit e4693a8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

main/src/user/http_app_token.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
#define TAG "http_app_token"
2424

25-
static char *data_ptr = NULL;
25+
static char *token_string = NULL;
2626

2727
esp_err_t http_app_token_event_handler(esp_http_client_event_t *evt)
2828
{
@@ -80,15 +80,18 @@ void http_app_token_prepare_data(char *buf, int len)
8080
cJSON *root = NULL;
8181
root = cJSON_CreateObject();
8282
cJSON_AddNumberToObject(root, "request", 100);
83-
cJSON_AddStringToObject(root, "token", data_ptr);
83+
cJSON_AddStringToObject(root, "token", token_string);
8484
cJSON_AddStringToObject(root, "mac", wifi_mac_string);
8585
cJSON_PrintPreallocated(root, buf, len, 0);
8686
cJSON_Delete(root);
8787
}
8888

8989
void http_app_verify_token(char *token)
9090
{
91-
data_ptr = token;
91+
if (token == NULL) {
92+
return;
93+
}
94+
token_string = token;
9295
EventBits_t uxBits = xEventGroupSync(
9396
user_event_group,
9497
HTTP_APP_TOKEN_RUN_BIT,

0 commit comments

Comments
 (0)