mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-14 23:44:01 +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 md5 from 'md5';
|
||||||
import { nanoid } from 'nanoid';
|
import { nanoid } from 'nanoid';
|
||||||
import { api } from '@/renderer/api';
|
import { api } from '@/renderer/api';
|
||||||
|
import { QueryOptions } from '@/renderer/lib/react-query';
|
||||||
import { useAuthStore } from '@/renderer/store';
|
import { useAuthStore } from '@/renderer/store';
|
||||||
|
|
||||||
export const useLogin = (
|
export const useLogin = (
|
||||||
@@ -9,7 +10,8 @@ export const useLogin = (
|
|||||||
body: {
|
body: {
|
||||||
password: string;
|
password: string;
|
||||||
username: string;
|
username: string;
|
||||||
}
|
},
|
||||||
|
options?: QueryOptions
|
||||||
) => {
|
) => {
|
||||||
const login = useAuthStore((state) => state.login);
|
const login = useAuthStore((state) => state.login);
|
||||||
|
|
||||||
@@ -35,5 +37,6 @@ export const useLogin = (
|
|||||||
localStorage.setItem('device_id', nanoid());
|
localStorage.setItem('device_id', nanoid());
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
...options,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -5,7 +5,7 @@ import { useSearchParams } from 'react-router-dom';
|
|||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import { Button, PasswordInput, Text, TextInput } from '@/renderer/components';
|
import { Button, PasswordInput, Text, TextInput } from '@/renderer/components';
|
||||||
import { ErrorFallback } from '@/renderer/features/action-required';
|
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';
|
import { normalizeServerUrl } from '@/renderer/utils';
|
||||||
|
|
||||||
const Container = styled(Box)`
|
const Container = styled(Box)`
|
||||||
|
|||||||
Reference in New Issue
Block a user