-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Load projects from firebase when logged in
- Loading branch information
Showing
6 changed files
with
24 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,13 @@ | ||
import useInvalidateProjectListQuery from './useInvalidateProjectListQuery'; | ||
|
||
export default function () { | ||
const projects = useProjects(); | ||
const account = useAccountService(); | ||
const closeTab = useCloseTab(); | ||
const invalidateProjectsQuery = useInvalidateProjectListQuery(); | ||
|
||
return (id: string) => { | ||
return async (id: string) => { | ||
await account.value.removeProject(id); | ||
await invalidateProjectsQuery(); | ||
closeTab(id); | ||
projects.value = projects.value.filter((project) => project.id !== id); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { useQueryClient } from '@tanstack/vue-query'; | ||
|
||
export default function () { | ||
const client = useQueryClient(); | ||
const accountId = useAccountServiceId(); | ||
return async () => { | ||
client.invalidateQueries({ | ||
queryKey: ['projects', accountId.value], | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export default function () { | ||
const route = useRoute(); | ||
const id = computed(() => route.params.id as string | undefined); | ||
const projects = useProjects(); | ||
const { data: projects } = useProjectListQuery(); | ||
|
||
return computed(() => projects.value.find((p) => p.id === id.value)); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters