Skip to content

Commit

Permalink
fix: address edge case for reading map stylejson url (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
achou11 authored Jan 13, 2025
1 parent 6958d57 commit b1db5e2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/react-query/maps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ export function mapStyleJsonUrlQueryOptions({
queryKey: getStyleJsonUrlQueryKey({ refreshToken }),
queryFn: async () => {
const result = await clientApi.getMapStyleJsonUrl()
return refreshToken ? result + `?refresh_token=${refreshToken}` : result

if (!refreshToken) return result

const u = new URL(result)
u.searchParams.set('refresh_token', refreshToken)
return u.href
},
})
}

0 comments on commit b1db5e2

Please sign in to comment.