15 lines
292 B
TypeScript
15 lines
292 B
TypeScript
|
import { useMutation } from "@tanstack/react-query"
|
||
|
|
||
|
function useLogin() {
|
||
|
return useMutation({
|
||
|
mutationFn: async (creds: { username: string; password: string }) => {
|
||
|
await fetch("/api/login", {
|
||
|
method: "POST",
|
||
|
body: JSON.stringify(creds),
|
||
|
})
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
|
||
|
export { useLogin }
|