add top menu (StandardMenu)

This commit is contained in:
Simon Vieille
2025-04-11 19:41:23 +02:00
parent e74de11215
commit 502cc4f3f0
5 changed files with 139 additions and 137 deletions
+16 -1
View File
@@ -18,11 +18,12 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import axios from '@nextcloud/axios'
import { generateUrl } from '@nextcloud/router'
import { generateUrl, generateOcsUrl } from '@nextcloud/router'
export const useNavStore = defineStore('nav', () => {
const categories = ref(null)
const apps = ref(null)
const coreApps = ref(null)
async function getApps() {
if (apps.value !== null) {
@@ -41,6 +42,19 @@ export const useNavStore = defineStore('nav', () => {
return apps.value
}
async function getCoreApps() {
if (coreApps.value !== null) {
return coreApps.value
}
coreApps.value = await axios
.get(generateOcsUrl('core/navigation', 2) + '/apps?format=json')
.then((response) => response.data)
.then((value) => value.ocs.data)
return coreApps.value
}
async function getCategories() {
if (categories.value !== null) {
return categories.value
@@ -53,6 +67,7 @@ export const useNavStore = defineStore('nav', () => {
return {
getApps,
getCoreApps,
getCategories,
}
})