mirror of
https://github.com/jeffvli/feishin.git
synced 2026-05-07 04:20:12 +02:00
Move login mutation
This commit is contained in:
+4
-1
@@ -2,6 +2,7 @@ import { useMutation } from '@tanstack/react-query';
|
||||
import md5 from 'md5';
|
||||
import { nanoid } from 'nanoid';
|
||||
import { api } from '@/renderer/api';
|
||||
import { QueryOptions } from '@/renderer/lib/react-query';
|
||||
import { useAuthStore } from '@/renderer/store';
|
||||
|
||||
export const useLogin = (
|
||||
@@ -9,7 +10,8 @@ export const useLogin = (
|
||||
body: {
|
||||
password: string;
|
||||
username: string;
|
||||
}
|
||||
},
|
||||
options?: QueryOptions
|
||||
) => {
|
||||
const login = useAuthStore((state) => state.login);
|
||||
|
||||
@@ -35,5 +37,6 @@ export const useLogin = (
|
||||
localStorage.setItem('device_id', nanoid());
|
||||
}
|
||||
},
|
||||
...options,
|
||||
});
|
||||
};
|
||||
@@ -5,7 +5,7 @@ import { useSearchParams } from 'react-router-dom';
|
||||
import styled from 'styled-components';
|
||||
import { Button, PasswordInput, Text, TextInput } from '@/renderer/components';
|
||||
import { ErrorFallback } from '@/renderer/features/action-required';
|
||||
import { useLogin } from '@/renderer/features/auth/queries/use-login';
|
||||
import { useLogin } from '@/renderer/features/auth/mutations/use-login';
|
||||
import { normalizeServerUrl } from '@/renderer/utils';
|
||||
|
||||
const Container = styled(Box)`
|
||||
|
||||
Reference in New Issue
Block a user