Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ The `GATSBY_SNOOTY_DEV` variable is what allows Gatsby to know that it should us

It should be set to `true` when working on snooty locally.

The `GATSBY_NEXT_API_BASE_URL` variable points to our production Nextjs app API.

#### `.env.production`

Snooty's `build` and `serve` stages use the `production` environment. Your `.env.production` file should be as follows:
Expand Down
9 changes: 6 additions & 3 deletions plugins/utils/breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ const { siteMetadata } = require('../../src/utils/site-metadata');

const breadcrumbType = `Breadcrumb`;

const createBreadcrumbNodes = async ({ db, createNode, createNodeId, createContentDigest }) => {
const createBreadcrumbNodes = async ({ createNode, createNodeId, createContentDigest }) => {
const { database, project } = siteMetadata;
let breadcrumbData;
try {
breadcrumbData = await db.fetchBreadcrumbs(database, project);
const res = await fetch(
`${process.env.GATSBY_NEXT_API_BASE_URL}/breadcrumbs/?dbName=${database}&project=${project}`
);
breadcrumbData = await res.json();
} catch (e) {
console.error(`Error while fetching breadcrumb data from Atlas: ${e}`);
console.error(`Error while fetching breadcrumb data from Docs Nextjs API: ${e}`);
}
const [breadcrumbs, propertyUrl] = breadcrumbData
? [breadcrumbData.breadcrumbs, breadcrumbData.propertyUrl]
Expand Down
12 changes: 0 additions & 12 deletions src/init/DocumentDatabase.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ class RealmInterface {
return this.realmClient.callFunction('updateOAChangelogMetadata', metadata);
}

async fetchBreadcrumbs(database, project) {
return this.realmClient.callFunction('fetchBreadcrumbs', database, project);
}

async fetchBanner(isDevBuild) {
return this.realmClient.callFunction('getBanner', isDevBuild);
}
Expand Down Expand Up @@ -125,10 +121,6 @@ class ManifestDocumentDatabase {
async fetchAllProducts() {
return this.realmInterface.fetchAllProducts();
}

async fetchBreadcrumbs(database, project) {
return this.realmInterface.fetchBreadcrumbs(database, project);
}
}

class RealmDocumentDatabase {
Expand Down Expand Up @@ -174,10 +166,6 @@ class RealmDocumentDatabase {
async updateOAChangelogMetadata(metadata) {
return this.realmInterface.updateOAChangelogMetadata(metadata);
}

async fetchBreadcrumbs(database, project) {
return this.realmInterface.fetchBreadcrumbs(database, project);
}
}

exports.manifestDocumentDatabase = new ManifestDocumentDatabase(process.env.GATSBY_MANIFEST_PATH);
Expand Down
4 changes: 0 additions & 4 deletions src/utils/realm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ export const fetchBanner = async (snootyEnv: SnootyEnv) => {
return callAuthenticatedFunction('getBanner', snootyEnv === 'development');
};

export const fetchBreadcrumbs = async (database: MetadataDatabaseName, project: string) => {
return callAuthenticatedFunction('fetchBreadcrumbs', database, project);
};

export const fetchSearchPropertyMapping = async (snootyEnv: SnootyEnv): Promise<SearchPropertyMapping> => {
return callAuthenticatedFunction('fetchSearchPropertyMapping', snootyEnv);
};
Expand Down