feat : add project archiving feature
Allow projects to be archived/unarchived from the ProjectDrawer, with a toggle filter on the projects page to show/hide archived projects. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,8 +5,9 @@ import { extractHydraMembers } from '~/utils/api'
|
||||
export function useProjectService() {
|
||||
const api = useApi()
|
||||
|
||||
async function getAll(): Promise<Project[]> {
|
||||
const data = await api.get<HydraCollection<Project>>('/projects')
|
||||
async function getAll(params?: { archived?: boolean }): Promise<Project[]> {
|
||||
const query = params?.archived !== undefined ? `?archived=${params.archived}` : ''
|
||||
const data = await api.get<HydraCollection<Project>>(`/projects${query}`)
|
||||
return extractHydraMembers(data)
|
||||
}
|
||||
|
||||
@@ -20,9 +21,9 @@ export function useProjectService() {
|
||||
})
|
||||
}
|
||||
|
||||
async function update(id: number, payload: Partial<ProjectWrite>): Promise<Project> {
|
||||
async function update(id: number, payload: Partial<ProjectWrite>, options?: { toastSuccessKey?: string }): Promise<Project> {
|
||||
return api.patch<Project>(`/projects/${id}`, payload as Record<string, unknown>, {
|
||||
toastSuccessKey: 'projects.updated',
|
||||
toastSuccessKey: options?.toastSuccessKey ?? 'projects.updated',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user