mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-25 03:42:30 +00:00
Log api
This commit is contained in:
@@ -91,8 +91,6 @@ const apiSyncStorage = new AsyncLocalStorage<GitBookAPI>();
|
||||
|
||||
export const DEFAULT_API_ENDPOINT = process.env.GITBOOK_API_URL ?? 'https://api.gitbook.com';
|
||||
|
||||
console.log("API endpoint", DEFAULT_API_ENDPOINT);
|
||||
|
||||
/**
|
||||
* Create a new API client with a token.
|
||||
*/
|
||||
@@ -117,9 +115,12 @@ export function apiWithToken(apiToken: string): GitBookAPI {
|
||||
export function api(): GitBookAPI {
|
||||
const existing = apiSyncStorage.getStore();
|
||||
if (existing) {
|
||||
console.log("Existing", existing);
|
||||
return existing;
|
||||
}
|
||||
|
||||
console.log("Bringing up API");
|
||||
|
||||
const headersList = headers();
|
||||
const apiToken = headersList.get('x-gitbook-token');
|
||||
|
||||
@@ -203,6 +204,7 @@ export const getPublishedContentByUrl = cache({
|
||||
visitorAuthToken: string | undefined,
|
||||
options: CacheFunctionOptions,
|
||||
) => {
|
||||
console.log("Requesting URL", url);
|
||||
try {
|
||||
const response = await api().urls.getPublishedContentByUrl(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user