useMongocampProxyMode
Tells you whether the module runs in server proxy mode (module option useServerProxy).
ts
const isProxyMode = useMongocampProxyMode() // booleanIt returns a plain boolean, not a ref: the option is fixed when the app is built.
In proxy mode nobody logs in. There is no token and no profile, and the server-side api key decides what a request may do. Code that reads the profile (isAdmin, roles, grants) needs to know this, or it hides everything from a user who is in fact allowed.
vue
<script setup lang="ts">
const isProxyMode = useMongocampProxyMode()
</script>
<template>
<!-- No login, so no account page and no logout -->
<UButton v-if="!isProxyMode" to="/account" label="Account" />
</template>For "may this user see the admin area" use canSeeAdmin / canSeeManagement from useMongocampRoles, which already include this check.
Related
useMongocampRoles—canSeeAdmin,canSeeManagementuseMongocampAdminGateanduseMongocampPermissions— never block in proxy modeuseMongocampClientApi— picks the proxy or the session client