update set password flow
This commit is contained in:
@@ -9,6 +9,7 @@ import { createAccount } from '@libs/storage';
|
||||
import { LoaderIcon } from '@shared/icons';
|
||||
|
||||
import { useOnboarding } from '@stores/onboarding';
|
||||
import { useStronghold } from '@stores/stronghold';
|
||||
|
||||
type FormValues = {
|
||||
privkey: string;
|
||||
@@ -31,11 +32,9 @@ const resolver: Resolver<FormValues> = async (values) => {
|
||||
export function ImportStep1Screen() {
|
||||
const queryClient = useQueryClient();
|
||||
const navigate = useNavigate();
|
||||
const setPrivkey = useStronghold((state) => state.setPrivkey);
|
||||
const setPubkey = useOnboarding((state) => state.setPubkey);
|
||||
|
||||
const [setPubkey, setPrivkey] = useOnboarding((state) => [
|
||||
state.setPubkey,
|
||||
state.setPrivkey,
|
||||
]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
|
||||
const account = useMutation({
|
||||
@@ -74,6 +73,7 @@ export function ImportStep1Screen() {
|
||||
|
||||
// use for onboarding process only
|
||||
setPubkey(pubkey);
|
||||
// add stronghold state
|
||||
setPrivkey(privkey);
|
||||
|
||||
// add account to local database
|
||||
|
||||
@@ -29,11 +29,15 @@ const resolver: Resolver<FormValues> = async (values) => {
|
||||
|
||||
export function ImportStep2Screen() {
|
||||
const navigate = useNavigate();
|
||||
const setPassword = useStronghold((state) => state.setPassword);
|
||||
|
||||
const [passwordInput, setPasswordInput] = useState('password');
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [pubkey, privkey] = useOnboarding((state) => [state.pubkey, state.privkey]);
|
||||
const [privkey, setPassword] = useStronghold((state) => [
|
||||
state.privkey,
|
||||
state.setPassword,
|
||||
]);
|
||||
|
||||
const pubkey = useOnboarding((state) => state.pubkey);
|
||||
|
||||
const { save } = useSecureStorage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user