A deployable markdown editor that connects with your self hosted files and lets you edit in a beautiful interface
1import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
2import { authApi } from '../api';
3
4export function useCurrentUser() {
5 return useQuery({
6 queryKey: ['user'],
7 queryFn: authApi.getCurrentUser,
8 retry: false,
9 });
10}
11
12export function useUserRepos() {
13 return useQuery({
14 queryKey: ['userRepos'],
15 queryFn: authApi.getUserRepos,
16 retry: false,
17 });
18}
19
20export function useLogout() {
21 const queryClient = useQueryClient();
22
23 return useMutation({
24 mutationFn: authApi.logout,
25 onSuccess: () => {
26 queryClient.clear();
27 window.location.href = '/';
28 },
29 });
30}