new features
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import type { components } from "@shared/api/__generated__/openapi.types"
|
||||
|
||||
import api from "@shared/api"
|
||||
|
||||
export type ProjectUpdateBody = components["schemas"]["ProjectUpdate"]
|
||||
export type ProjectRead = components["schemas"]["ProjectRead"]
|
||||
|
||||
interface IUseUpdateProjectParams {
|
||||
onSuccess?: (project: ProjectRead) => void
|
||||
onError?: (error: unknown) => void
|
||||
}
|
||||
|
||||
export const useUpdateProject = ({
|
||||
onSuccess,
|
||||
onError,
|
||||
}: IUseUpdateProjectParams = {}) => {
|
||||
return api.useMutation("patch", "/api/projects/{project_id}/", {
|
||||
onSuccess: (project) => {
|
||||
onSuccess?.(project)
|
||||
},
|
||||
onError: (error) => {
|
||||
onError?.(error)
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user