diff --git a/components/EntityShow.vue b/components/EntityShow.vue
index dc3dec8..dbfb20b 100644
--- a/components/EntityShow.vue
+++ b/components/EntityShow.vue
@@ -45,6 +45,7 @@ const router = useRouter()
const route = useRoute()
const dataStore = useDataStore()
const modal = useModal()
+const auth = useAuthStore()
const dataType = dataStore.dataTypes[type]
@@ -97,6 +98,43 @@ const onTabChange = (index) => {
router.push(`${router.currentRoute.value.path}?tabIndex=${index}`)
}
+const changePinned = async () => {
+ let newPins = []
+
+ if(auth.profile.pinned_on_navigation.find(i => i.datatype === type && i.id === props.item.id)){
+ //Remove Pin
+
+ newPins = auth.profile.pinned_on_navigation.filter(i => !(i.datatype === type && i.id === props.item.id))
+ } else {
+ //Add Pin
+
+ newPins = [
+ ...auth.profile.pinned_on_navigation,
+ {
+ id: props.item.id,
+ icon: "i-heroicons-document",
+ type: "standardEntity",
+ datatype: type,
+ label: props.item[dataType.templateColumns.find(i => i.title).key]
+ }
+ ]
+ }
+
+ const res = await useNuxtApp().$api(`/api/user/${auth.user.id}/profile`,{
+ method: "PUT",
+ body: {
+ data: {
+ pinned_on_navigation: newPins
+ }
+ }
+ })
+
+ await auth.fetchMe()
+
+
+
+}
+
@@ -147,6 +185,13 @@ const onTabChange = (index) => {
>{{item ? `${dataType.labelSingle}${props.item[dataType.templateColumns.find(i => i.title).key] ? ': ' + props.item[dataType.templateColumns.find(i => i.title).key] : ''}`: '' }}
+
diff --git a/components/MainNav.vue b/components/MainNav.vue
index 4d16dd6..6ecd8fb 100644
--- a/components/MainNav.vue
+++ b/components/MainNav.vue
@@ -16,6 +16,13 @@ const links = computed(() => {
target: "_blank",
pinned: true
}
+ }else if(pin.type === "standardEntity") {
+ return {
+ label: pin.label,
+ to: `/standardEntity/${pin.datatype}/show/${pin.id}`,
+ icon: pin.icon,
+ pinned: true
+ }
}
}),
diff --git a/plugins/api.ts b/plugins/api.ts
index cb99a85..f57a636 100644
--- a/plugins/api.ts
+++ b/plugins/api.ts
@@ -1,6 +1,6 @@
export default defineNuxtPlugin(() => {
const api = $fetch.create({
- baseURL: "https://backend.fedeo.io",
+ baseURL: "http://localhost:3100" /*"https://backend.fedeo.io"*/,
credentials: "include",
onRequest({ options }) {
// Token aus Cookie holen