Finish reworking most templates pages

This commit is contained in:
Julien Nahum
2023-12-19 17:10:07 +01:00
parent eda1af9b1b
commit aac4d1da04
5 changed files with 99 additions and 333 deletions

View File

@@ -17,7 +17,7 @@ export const useTemplatesStore = defineStore('templates', () => {
return types.value.get(slug)
}).filter((item) => item !== undefined)
}
const getTemplateIndustries =(slugs) => {
const getTemplateIndustries = (slugs) => {
return slugs.map((slug) => {
return industries.value.get(slug)
}).filter((item) => item !== undefined)
@@ -50,8 +50,12 @@ export const fetchAllTemplates = () => {
return useOpnApi(templatesEndpoint)
}
export const loadTypesAndIndustries = () => {
// Load the json files
export const loadAllTemplates = async (store) => {
if (!store.allLoaded) {
store.startLoading()
store.initTypesAndIndustries()
const {data} = await fetchAllTemplates()
store.set(data.value)
store.allLoaded = true
}
}