Skip to content

Commit

Permalink
fix empty params
Browse files Browse the repository at this point in the history
  • Loading branch information
uyab committed Apr 24, 2022
1 parent 597a950 commit 2ec6ef6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/MetabaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ class MetabaseService
*/
public function setParams(array $params): void
{
if (empty($params)) {
$params = ['foo' => null];
}

$this->params = $params;
}

Expand Down Expand Up @@ -70,14 +66,18 @@ public function generateEmbedUrl(?int $dashboard, ?int $question): string
throw new InvalidArgumentException('Dashboard or question must be specified');
}

$builder->withClaim('params', $this->params);
$params = $this->params;
if (empty($params)) {
$params = (object) $params;
}
$builder->withClaim('params', $params);

$token = $builder
->getToken($config->signer(), $config->signingKey())
->toString();

return sprintf(
'%s/embed/%s/%s#' . http_build_query($this->additionalParams),
'%s/embed/%s/%s#'.http_build_query($this->additionalParams),
config('services.metabase.url'),
$this->type,
$token
Expand Down

0 comments on commit 2ec6ef6

Please sign in to comment.