diff --git a/src/components/flow/ProductionFlow.vue b/src/components/flow/ProductionFlow.vue index f686ed2..e99e0dc 100644 --- a/src/components/flow/ProductionFlow.vue +++ b/src/components/flow/ProductionFlow.vue @@ -9,8 +9,9 @@ const store = useProductionFlow()
diff --git a/src/modules/flow/store/useProductionFlow.store.ts b/src/modules/flow/store/useProductionFlow.store.ts index abf52c0..1464d30 100644 --- a/src/modules/flow/store/useProductionFlow.store.ts +++ b/src/modules/flow/store/useProductionFlow.store.ts @@ -1,7 +1,9 @@ import { pinia } from "@/store/store" import { defineStore } from "pinia" +import { nanoid } from "nanoid" interface Team { + id: string name: string intention: string responsible: string @@ -9,6 +11,8 @@ interface Team { outputs: string[] } +type NewTeam = Omit + interface State { teams: Team[] } @@ -16,6 +20,7 @@ interface State { const initialState: State = { teams: [ { + id: nanoid(), name: "In production", intention: "Deliver feature to the user", responsible: "Product owner", @@ -28,8 +33,11 @@ const initialState: State = { const useStore = defineStore("production-flow", { state: () => ({ ...initialState }), actions: { - addTeam(team: Team) { - this.$state.teams = [team, ...this.$state.teams] + addTeam(newTeam: NewTeam) { + this.$state.teams = [{ id: nanoid(), ...newTeam }, ...this.$state.teams] + }, + removeTeam(id: string) { + this.$state.teams = this.$state.teams.filter((team) => team.id !== id) }, }, })