first commit
Some checks failed
Deploy / lint (push) Failing after 7s
Deploy / test (push) Has been skipped
Deploy / deploy (push) Has been skipped

This commit is contained in:
Dennis Thiessen
2026-02-20 17:31:01 +01:00
commit 61ab24490d
160 changed files with 17034 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import { useMutation } from '@tanstack/react-query';
import * as authApi from '../api/auth';
import { useAuthStore } from '../stores/authStore';
export function useLogin() {
const storeLogin = useAuthStore((s) => s.login);
return useMutation({
mutationFn: ({ username, password }: { username: string; password: string }) =>
authApi.login(username, password),
onSuccess: (data) => {
storeLogin(data.access_token);
},
});
}
export function useRegister() {
return useMutation({
mutationFn: ({ username, password }: { username: string; password: string }) =>
authApi.register(username, password),
});
}