diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-15 12:24:42 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-15 17:26:16 +0100 |
| commit | 0f38aee374029213a47ef7c29bd164093fe63c85 (patch) | |
| tree | 290cb6471fdfe81e4c42f4da4729247536b04ee7 /src/utils/config.ts | |
| parent | be4d907efb4e2fa658baa7c9b276ed282eb920db (diff) | |
refactor(hooks): remove useSettings hook
It does not make sense to re-export an existing object through a hook.
On some pages both the hook and the object was imported...
It is better to use the CONFIG (previously settings) object directly
and by doing it we avoid potential errors because of conditional hooks.
Diffstat (limited to 'src/utils/config.ts')
| -rw-r--r-- | src/utils/config.ts | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/utils/config.ts b/src/utils/config.ts index 61a46b4..edd9b2f 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -1,10 +1,12 @@ const isStaging = process.env.NEXT_PUBLIC_APP_ENV === 'staging'; -export const settings = { +export const CONFIG = { ackee: { - filename: process.env.NEXT_PUBLIC_ACKEE_FILENAME || 'tracker.js', - siteId: process.env.NEXT_PUBLIC_ACKEE_SITE_ID || '', - url: `https://${process.env.NEXT_PUBLIC_ACKEE_DOMAIN}` || '', + filename: process.env.NEXT_PUBLIC_ACKEE_FILENAME ?? 'tracker.js', + siteId: process.env.NEXT_PUBLIC_ACKEE_SITE_ID ?? '', + url: process.env.NEXT_PUBLIC_ACKEE_DOMAIN + ? `https://${process.env.NEXT_PUBLIC_ACKEE_DOMAIN}` + : '', }, api: { url: isStaging @@ -12,15 +14,12 @@ export const settings = { : process.env.NEXT_PUBLIC_GRAPHQL_API, }, name: 'Armand Philippot', - baseline: { - en: 'Front-end developer', - fr: 'Intégrateur web', - }, + baseline: 'Intégrateur web', copyright: { startYear: '2012', endYear: new Date().getFullYear().toString(), }, - email: process.env.APP_AUTHOR_EMAIL || '', + email: process.env.APP_AUTHOR_EMAIL ?? '', locales: { defaultLocale: 'fr', defaultCountry: 'FR', @@ -31,5 +30,5 @@ export const settings = { url: (isStaging ? process.env.NEXT_PUBLIC_STAGING_APP_URL - : process.env.NEXT_PUBLIC_APP_URL) || '', + : process.env.NEXT_PUBLIC_APP_URL) ?? '', }; |
