-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve public layout by using a properly mocked Customer entity shar…
…ed between SSG/SSR pages + improve doc
- Loading branch information
1 parent
bd0a27a
commit c7ab58b
Showing
4 changed files
with
36 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Customer } from '@/modules/core/data/types/Customer'; | ||
import { GraphCMSDataset } from '@/modules/core/data/types/GraphCMSDataset'; | ||
|
||
const customerRef: string = process.env.NEXT_PUBLIC_CUSTOMER_REF; | ||
|
||
/** | ||
* This mocked static dataset is used by the "public" layout to start the app with the minimalist amount of data. | ||
* | ||
* XXX The "Customer" entity represents a "Tenant" in a multi-tenancy system. It's basically the owner of a site. | ||
* Each Customer has its own website, with its own data. | ||
* | ||
* Fields required by NRN to function properly by default (they can be hardcoded if you only have one Customer, or fetched from a DB if you have many) | ||
* - 'ref': Identifier of the customer. Use by analytics, monitoring, etc. | ||
* - 'availableLanguages': List of languages the website is available in, static pages will be generated for all listed languages. | ||
* - '__typename': Must be "Customer". You can rename it if you wish to, but you'll need to adapt the code in various places. | ||
* | ||
* @see https://unlyed.github.io/next-right-now/concepts/tenancy.html#tenancy-st-mt-ht-and-mst | ||
*/ | ||
export const mockedStaticDataset: GraphCMSDataset = { | ||
customer: { | ||
ref: customerRef, | ||
availableLanguages: ['en'], // Necessary to generate the static pages and serve SSR pages, for those languages | ||
__typename: 'Customer', // Necessary to find the customer object within the mocked dataset | ||
} as Customer, // TS casting is necessary because we don't provide all properties | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters