FEAT: Implement authenticated internal API call utility to forward cookies and enhance authentication handling
This commit is contained in:
@@ -1,23 +1,17 @@
|
||||
export const usePortalTags = () => {
|
||||
const { fetchUser, setUser } = useDirectusAuth();
|
||||
const user = useDirectusUser();
|
||||
|
||||
const tags = computed(() => (toValue(user)?.tags as Array<string>) || []);
|
||||
const { user } = useUnifiedAuth();
|
||||
|
||||
const details = computed(() => {
|
||||
const value = toValue(tags);
|
||||
|
||||
// Since we've migrated to Keycloak and removed Directus,
|
||||
// we'll enable the interest menu for all authenticated users
|
||||
// In the future, this could be enhanced with Keycloak roles/attributes
|
||||
|
||||
const isAuthenticated = !!user.value;
|
||||
|
||||
return {
|
||||
interest: value.includes("portal-interest"),
|
||||
interest: isAuthenticated, // All authenticated users see the interest menu
|
||||
};
|
||||
});
|
||||
|
||||
onBeforeMount(async () => {
|
||||
if (!user.value) {
|
||||
const user = await fetchUser();
|
||||
setUser(user.value);
|
||||
}
|
||||
});
|
||||
|
||||
return details;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user