Skip to content

Commit

Permalink
fix: geojson endpoint now returns pure geojson
Browse files Browse the repository at this point in the history
  • Loading branch information
ardouglass committed Apr 27, 2020
1 parent 7d018c4 commit e7ba606
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 17 deletions.
2 changes: 1 addition & 1 deletion address-mapper.php
Expand Up @@ -9,7 +9,7 @@
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Requires at least: 5.4
* Tested up to: 5.4
* Version: 1.0.2
* Version: 1.0.3
*/

// If this file is called directly, abort.
Expand Down
14 changes: 2 additions & 12 deletions backend/Endpoints/Points.php
Expand Up @@ -255,20 +255,10 @@ public static function get_geojson($request) {
'features' => $values
];

// Return data
$full_response = [
'code' => 'get_success',
'message' => 'Retrieved locations.',
'data' => [
'status' => 200,
'geojson' => $geojson
]
];

add_filter(
'rest_pre_serve_request',
function () use ($full_response) {
echo json_encode($full_response, JSON_NUMERIC_CHECK);
function () use ($geojson) {
echo json_encode($geojson, JSON_NUMERIC_CHECK);
return true;
},
10,
Expand Down
2 changes: 1 addition & 1 deletion composer.json
@@ -1,6 +1,6 @@
{
"name": "ardouglass/address-mapper",
"version": "1.0.2",
"version": "1.0.3",
"description": "A WordPress plugin that allows users to upload CSVs of addresses, and then query them using a custom endpoint of the WordPress REST API.",
"type": "wordpress-plugin",
"require": {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "address-mapper",
"version": "1.0.2",
"version": "1.0.3",
"description": "A WordPress plugin that allows users to upload CSVs of addresses, and then query them using a custom endpoint of the WordPress REST API.",
"private": true,
"scripts": {
Expand Down

0 comments on commit e7ba606

Please sign in to comment.