26 lines
633 B
TypeScript
26 lines
633 B
TypeScript
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)
|
|
},
|
|
})
|
|
}
|