(artifactId: string)
| 117 | } |
| 118 | }, |
| 119 | async deleteArtifact(artifactId: string) { |
| 120 | set((state) => ({ |
| 121 | deleting: { ...state.deleting, [artifactId]: true }, |
| 122 | })); |
| 123 | try { |
| 124 | await api.artifacts.delete(artifactId); |
| 125 | // Remove artifact from library after successful deletion |
| 126 | set((state) => ({ |
| 127 | library: state.library.filter((a) => a.id !== artifactId), |
| 128 | })); |
| 129 | } catch (error) { |
| 130 | console.error('Failed to delete artifact', error); |
| 131 | throw error; |
| 132 | } finally { |
| 133 | set((state) => { |
| 134 | const { [artifactId]: _removed, ...next } = state.deleting; |
| 135 | return { deleting: next }; |
| 136 | }); |
| 137 | } |
| 138 | }, |
| 139 | })); |
no test coverage detected