From 6d11d006ec2bc6e2df877ac973eaacd7ef92f24b Mon Sep 17 00:00:00 2001 From: ekazak Date: Fri, 17 Jun 2022 15:55:04 +0300 Subject: [PATCH] LAW-5279 --- .gitignore | 1 + htdocs/wp-config-local-sample.php | 1 + .../plugins/wp-rest-api-event/HttpClient.php | 10 ++++++---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d1175ba..91cf196 100644 --- a/.gitignore +++ b/.gitignore @@ -28,5 +28,6 @@ htdocs/wp-content/themes/* !htdocs/wp-content/themes/index.php !htdocs/wp-content/plugins/wp-rest-api-event +!htdocs/wp-content/plugins/subscribe-to-lc vendor/ diff --git a/htdocs/wp-config-local-sample.php b/htdocs/wp-config-local-sample.php index 9c9bfd7..28f686e 100755 --- a/htdocs/wp-config-local-sample.php +++ b/htdocs/wp-config-local-sample.php @@ -11,3 +11,4 @@ define('LAWCARTA_SUBDOMAIN', 'app'); define('LAWCARTA_PORT', ''); define('LAWCARTA_WP_REST_API_URL', 'http://app.livecarta.loc/v1'); +define('LAWCARTA_WP_REST_API_EVENT_LOG_URL', 'http://app.livecarta.loc/v1/event/add'); diff --git a/htdocs/wp-content/plugins/wp-rest-api-event/HttpClient.php b/htdocs/wp-content/plugins/wp-rest-api-event/HttpClient.php index 26bcff5..ac5e0e9 100755 --- a/htdocs/wp-content/plugins/wp-rest-api-event/HttpClient.php +++ b/htdocs/wp-content/plugins/wp-rest-api-event/HttpClient.php @@ -59,10 +59,12 @@ class HttpClient ]); $sysLogId = null; /** @var \WP_HTTP_Requests_Response $httpResponse */ - $httpResponse = $response['http_response']; - if ($httpResponse->get_status() == 200) { - $body = isset($response['body']) ? json_decode($response['body'], true) : null; - $sysLogId = $body['sysLogId'] ?? null; + if(!empty($response['http_response'])){ + $httpResponse = $response['http_response']; + if ($httpResponse->get_status() == 200) { + $body = isset($response['body']) ? json_decode($response['body'], true) : null; + $sysLogId = $body['sysLogId'] ?? null; + } } return $sysLogId;