ee5ae8af62
* 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
20 lines
616 B
TypeScript
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
|
|
}
|