Files
speckle-server/packages/frontend-2/composables/env.ts
T
Kristaps Fabians Geikins ee5ae8af62 fix(fe2): accept invite before onboarding after sign up (#2491)
* explicitly ordering global middlewares

* various subscription fixes & WIP project invite middleware

* SSR invite accept & toast notifs seem to work

* backend support for mixpanel

* mixpanel be logic -> shared

* minor fix

* finissh

* lint fix

* minor comment adjustments

* better adblock handling
2024-07-11 11:45:11 +03:00

20 lines
616 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 = (
options?: Partial<{
forcePublic: boolean
}>
) => {
const {
public: { apiOrigin, backendApiOrigin }
} = useRuntimeConfig()
if (import.meta.server && backendApiOrigin.length > 1 && !options?.forcePublic) {
return backendApiOrigin
}
return apiOrigin
}