Skip to content

Commit

Permalink
fix(next-drupal): handle nested params in getResourceByPath
Browse files Browse the repository at this point in the history
  • Loading branch information
shadcn committed Dec 21, 2021
1 parent 3185cd4 commit 36e756b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/next-drupal/src/get-resource.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { GetStaticPropsContext } from "next"
import { stringify } from "qs"
import {
AccessToken,
JsonApiParams,
Expand Down Expand Up @@ -101,14 +102,13 @@ export async function getResourceByPath<T extends JsonApiResource>(
}

const { resourceVersion = "rel:latest-version", ...params } = options?.params
const resourceParams = new URLSearchParams({
...params,
})

if (options.isVersionable) {
resourceParams.set("resourceVersion", resourceVersion)
params.resourceVersion = resourceVersion
}

const resourceParams = stringify(params)

const payload = [
{
requestId: "router",
Expand Down

0 comments on commit 36e756b

Please sign in to comment.