83d8035dc2
* root + server * frontend * frontend-2 * dui3 * dui3 * tailwind theme * ui-components * preview service * viewer * viewer-sandbox * fileimport-service * webhook service * objectloader * shared * ui-components-nuxt * WIP full config * WIP full linter * eslint projectwide util * minor fix * removing redundant ci * clean up test errors * fixed prettier formatting * CI improvements * TSC lint fix * 'buildBatch' needs to be async since some batch types (like Text) require it. Removed a disabled liniting rule from ObjLoader * removed unnecessary void --------- Co-authored-by: AlexandruPopovici <alexandrupopoviciioan@gmail.com>
16 lines
538 B
TypeScript
16 lines
538 B
TypeScript
/**
|
|
* IMPORTANT: Don't use this directly in Vue templates that may render in SSR, cause this may cause the backend API origin to be rendered instead of the clientside one,
|
|
* at least until the app finishes hydrating. If people click on links based on this too early, they may end up in the wrong place.
|
|
*/
|
|
export const useApiOrigin = () => {
|
|
const {
|
|
public: { apiOrigin, backendApiOrigin }
|
|
} = useRuntimeConfig()
|
|
|
|
if (import.meta.server && backendApiOrigin.length > 1) {
|
|
return backendApiOrigin
|
|
}
|
|
|
|
return apiOrigin
|
|
}
|