16 lines
614 B
TypeScript
16 lines
614 B
TypeScript
import { api } from "../../../api"
|
|
import { navigation, serviceNavigation } from "../../store"
|
|
export async function loadNavigationAndSetStores(): Promise<null> {
|
|
const navigations = await api<Navigation[]>("navigation", {})
|
|
let navigationStore: NavElement[] = []
|
|
let serviceNavigationStore: NavElement[] = []
|
|
navigations.data.forEach((nav: Navigation) => {
|
|
if (nav.tree == 0) navigationStore = nav.elements
|
|
else if (nav.tree == 1) serviceNavigationStore = nav.elements
|
|
})
|
|
navigation.set(navigationStore)
|
|
serviceNavigation.set(serviceNavigationStore)
|
|
|
|
return null
|
|
}
|