fix: sort in store

This commit is contained in:
kolaente 2023-04-14 17:21:28 +02:00
parent a3e2cbeb27
commit 46e825820c
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 4 additions and 5 deletions

View File

@ -85,10 +85,8 @@ import ProjectsNavigation from '@/components/home/ProjectsNavigation.vue'
const baseStore = useBaseStore() const baseStore = useBaseStore()
const projectStore = useProjectStore() const projectStore = useProjectStore()
const projects = computed(() => projectStore.notArchivedRootProjects const projects = computed(() => projectStore.notArchivedRootProjects)
.sort((a, b) => a.position - b.position)) const favoriteProjects = computed(() => projectStore.favoriteProjects)
const favoriteProjects = computed(() => projectStore.favoriteProjects
.sort((a, b) => a.position - b.position))
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -32,7 +32,8 @@ export const useProjectStore = defineStore('project', () => {
// The projects are stored as an object which has the project ids as keys. // The projects are stored as an object which has the project ids as keys.
const projects = ref<ProjectState>({}) const projects = ref<ProjectState>({})
const projectsArray = computed(() => Object.values(projects.value)) const projectsArray = computed(() => Object.values(projects.value)
.sort((a, b) => a.position - b.position))
const notArchivedRootProjects = computed(() => projectsArray.value const notArchivedRootProjects = computed(() => projectsArray.value
.filter(p => p.parentProjectId === 0 && !p.isArchived)) .filter(p => p.parentProjectId === 0 && !p.isArchived))
const favoriteProjects = computed(() => projectsArray.value const favoriteProjects = computed(() => projectsArray.value