@prismicio/client
Advanced tools
Comparing version 6.0.0-beta.1 to 6.0.0-beta.2
{ | ||
"name": "@prismicio/client", | ||
"version": "6.0.0-beta.1", | ||
"version": "6.0.0-beta.2", | ||
"description": "The official JavaScript + TypeScript client library for Prismic", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -952,3 +952,12 @@ import * as prismicT from "@prismicio/types"; | ||
async getRepository(): Promise<prismicT.Repository> { | ||
return await this.fetch<prismicT.Repository>(this.endpoint); | ||
// TODO: Restore when Authorization header support works in browsers with CORS. | ||
// return await this.fetch<prismicT.Repository>(this.endpoint); | ||
const url = new URL(this.endpoint); | ||
if (this.accessToken) { | ||
url.searchParams.set("access_token", this.accessToken); | ||
} | ||
return await this.fetch<prismicT.Repository>(url.toString()); | ||
} | ||
@@ -1086,3 +1095,3 @@ | ||
routes: params.routes || this.routes, | ||
accessToken: undefined, | ||
accessToken: params.accessToken || this.accessToken, | ||
}); | ||
@@ -1337,10 +1346,12 @@ } | ||
url: string, | ||
params?: Partial<BuildQueryURLArgs>, | ||
// TODO: Change to `params` when Authorization header support works in browsers with CORS. | ||
_params?: Partial<BuildQueryURLArgs>, | ||
): Promise<T> { | ||
const accessToken = (params && params.accessToken) || this.accessToken; | ||
const options = accessToken | ||
? { headers: { Authorization: `Token ${accessToken}` } } | ||
: {}; | ||
// TODO: Restore when Authorization header support works in browsers with CORS. | ||
// const accessToken = (params && params.accessToken) || this.accessToken; | ||
// const options = accessToken | ||
// ? { headers: { Authorization: `Token ${accessToken}` } } | ||
// : {}; | ||
const res = await this.fetchFn(url, options); | ||
const res = await this.fetchFn(url); | ||
@@ -1347,0 +1358,0 @@ // eslint-disable-next-line @typescript-eslint/no-explicit-any |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
333475
4257