2024-09-10 12:09:53 +02:00
|
|
|
import { defineStore } from "pinia";
|
2024-10-30 10:56:11 +01:00
|
|
|
import { ref, computed } from "vue";
|
2024-09-10 12:09:53 +02:00
|
|
|
|
|
|
|
|
export const useUserStore = defineStore("user", () => {
|
|
|
|
|
const user = ref(null);
|
|
|
|
|
|
2024-10-30 10:56:11 +01:00
|
|
|
const notifications = computed(() => {
|
2024-11-13 07:46:32 +01:00
|
|
|
return typeof user.value.notifications === "array"
|
|
|
|
|
? user.value.notifications
|
|
|
|
|
: Object.values(user.value.notifications);
|
2024-10-30 10:56:11 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return { user, notifications };
|
2024-09-10 12:09:53 +02:00
|
|
|
});
|