add top menu (StandardMenu)
This commit is contained in:
+16
-1
@@ -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,
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user