Skip to content

Commit

Permalink
refactor: rename auth of server routes
Browse files Browse the repository at this point in the history
  • Loading branch information
rezaelahidev committed Nov 3, 2024
1 parent 3837601 commit c5782cd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ protected function register( string $option_key ): \WP_REST_Response {

// Send to https://api.blockera.ai.
$result = $this->sender->post(
Config::getServerURL( '/user/register' ),
Config::getServerURL( '/auth/register' ),
[
'headers' => [
'Accept' => 'application/json',
Expand Down
11 changes: 7 additions & 4 deletions packages/telemetry/php/Jobs.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ public function doRefreshToken(): void {

if ( $token ) {

$response = $this->sender->get(
Config::getServerURL( '/refresh-token' ),
$response = $this->sender->post(
Config::getServerURL( '/auth/refresh-token' ),
[
'headers' => [
'Accept' => 'application/json',
Expand All @@ -119,8 +119,11 @@ public function doRefreshToken(): void {

$response = $this->sender->getResponseBody( $response );

// Update the token recieved from server.
echo update_option( $this->config['options']['token'], $response['data']['token'] );
if ( isset( $response['data']['token'] ) ) {

// Update the token recieved from server.
update_option( Config::getOptionKeys( 'token' ), $response['data']['token'] );
}
}
}
}
Expand Down

0 comments on commit c5782cd

Please sign in to comment.