FEAT: Implement authenticated internal API call utility to forward cookies and enhance authentication handling

This commit is contained in:
2025-06-15 17:48:40 +02:00
parent a7df6834d7
commit 3a83831a20
5 changed files with 216 additions and 21 deletions

View File

@@ -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;
};