mirror of
https://github.com/acid-info/logos-ordinals-dashboard.git
synced 2025-02-11 20:57:01 +00:00
28 lines
623 B
TypeScript
28 lines
623 B
TypeScript
import { useMutation } from '@tanstack/react-query'
|
|
import { AxiosResponse } from 'axios'
|
|
import { api } from '../../common/api'
|
|
|
|
interface UnstakeRequest {
|
|
operator_id: string
|
|
}
|
|
|
|
interface UnstakeResponse {
|
|
success: boolean
|
|
message: string
|
|
}
|
|
|
|
const postUnstake = async ({
|
|
operator_id,
|
|
}: UnstakeRequest): Promise<UnstakeResponse> => {
|
|
const response: AxiosResponse<UnstakeResponse> = await api.post(
|
|
`/operators/${operator_id}/unstake`,
|
|
)
|
|
return response.data
|
|
}
|
|
|
|
export const useUnstakeOperator = () => {
|
|
return useMutation<UnstakeResponse, Error, UnstakeRequest>({
|
|
mutationFn: postUnstake,
|
|
})
|
|
}
|