add list of available countries

This commit is contained in:
GotPPay
2018-09-03 14:25:14 +02:00
committed by Bilal Catic
parent 4ce7b86ea9
commit b3cff5d095
2 changed files with 37 additions and 27 deletions

View File

@@ -15,6 +15,12 @@ class Wiass_REST_User_API {
'callback' => array(__CLASS__, 'validate_token'),
'permission_callback' => 'is_user_logged_in'
) );
register_rest_route( self::$namespace, 'user/get-countries', array(
'methods' => 'GET',
'callback' => array(__CLASS__, 'get_countries'),
'permission_callback' => 'is_user_logged_in'
) );
}
@@ -31,4 +37,23 @@ class Wiass_REST_User_API {
)
));
}
public static function get_countries(){
$result = [
array(
'idCountry' => '1',
'countryName' => 'Sweden'
),
array(
'idCountry' => '2',
'countryName' => 'Finland'
),
array(
'idCountry' => '3',
'countryName' => 'Denmark'
)
];
return new WP_REST_Response($result);
}
}