From 436359594bfbc6821fdd8d957f49ba53f83a8085 Mon Sep 17 00:00:00 2001 From: HumanoidSandvichDispenser Date: Tue, 19 Nov 2024 01:06:44 -0800 Subject: [PATCH] refactor: Split teams store into separate stores Refactor the codebase to move invites and integrations logic into separate stores. This change improves the separation of concerns and maintainability by isolating the invites and integrations logic from the teams store. --- availabili.tf/src/components/InviteEntry.vue | 6 +- .../src/components/PlayerTeamCard.vue | 23 +-- availabili.tf/src/composables/team-details.ts | 4 +- availabili.tf/src/stores/teams.ts | 165 +++--------------- .../src/stores/teams/integrations.ts | 44 +++++ availabili.tf/src/stores/teams/invites.ts | 48 +++++ .../views/TeamSettings/IntegrationsView.vue | 12 +- .../src/views/TeamSettings/InvitesView.vue | 6 +- 8 files changed, 135 insertions(+), 173 deletions(-) create mode 100644 availabili.tf/src/stores/teams/integrations.ts create mode 100644 availabili.tf/src/stores/teams/invites.ts diff --git a/availabili.tf/src/components/InviteEntry.vue b/availabili.tf/src/components/InviteEntry.vue index 186db1b..03927fb 100644 --- a/availabili.tf/src/components/InviteEntry.vue +++ b/availabili.tf/src/components/InviteEntry.vue @@ -1,10 +1,10 @@ diff --git a/availabili.tf/src/components/PlayerTeamCard.vue b/availabili.tf/src/components/PlayerTeamCard.vue index e7603f9..98796c2 100644 --- a/availabili.tf/src/components/PlayerTeamCard.vue +++ b/availabili.tf/src/components/PlayerTeamCard.vue @@ -1,9 +1,8 @@ diff --git a/availabili.tf/src/views/TeamSettings/InvitesView.vue b/availabili.tf/src/views/TeamSettings/InvitesView.vue index 21c0f4e..b4212e5 100644 --- a/availabili.tf/src/views/TeamSettings/InvitesView.vue +++ b/availabili.tf/src/views/TeamSettings/InvitesView.vue @@ -3,8 +3,10 @@ import { useTeamDetails } from "@/composables/team-details"; import { useTeamsStore } from "@/stores/teams"; import { onMounted } from "vue"; import InviteEntry from "@/components/InviteEntry.vue"; +import { useInvitesStore } from "@/stores/teams/invites"; const teamsStore = useTeamsStore(); +const invitesStore = useInvitesStore(); const { team, @@ -13,12 +15,12 @@ const { } = useTeamDetails(); function createInvite() { - teamsStore.createInvite(team.value.id); + invitesStore.createInvite(team.value.id); } onMounted(() => { teamsStore.fetchTeam(teamId.value) - .then(() => teamsStore.getInvites(teamId.value)); + .then(() => invitesStore.getInvites(teamId.value)); });