Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(playground): fix & refactor application entrypoint config
- Loading branch information
Showing
2 changed files
with
34 additions
and
22 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,28 @@ | ||
export const getConfig = () => { | ||
|
||
let project = import.meta.env.VITE_CONTEMBER_ADMIN_PROJECT_NAME | ||
if (project === '__PROJECT_SLUG__') { | ||
project = window.location.pathname.split('/')[1] | ||
} | ||
|
||
let basePath = import.meta.env.BASE_URL ?? '/' | ||
if (basePath === './') { | ||
basePath = `/${project}/` | ||
} | ||
const apiBaseUrl = import.meta.env.VITE_CONTEMBER_ADMIN_API_BASE_URL as string | ||
if (!apiBaseUrl) { | ||
throw new Error('VITE_CONTEMBER_ADMIN_API_BASE_URL is not set') | ||
} | ||
const sessionToken = import.meta.env.VITE_CONTEMBER_ADMIN_SESSION_TOKEN as string | ||
if (!sessionToken) { | ||
throw new Error('VITE_CONTEMBER_ADMIN_SESSION_TOKEN is not set') | ||
} | ||
|
||
return { | ||
project, | ||
sessionToken, | ||
basePath, | ||
apiBaseUrl, | ||
stage: 'live', | ||
} | ||
} |
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