update stronghold
This commit is contained in:
@@ -3,11 +3,8 @@ import { create } from 'zustand';
|
||||
interface OnboardingState {
|
||||
profile: { [x: string]: string };
|
||||
pubkey: string;
|
||||
privkey: string;
|
||||
createProfile: (data: { [x: string]: string }) => void;
|
||||
setPubkey: (pubkey: string) => void;
|
||||
setPrivkey: (privkey: string) => void;
|
||||
clearPrivkey: (privkey: string) => void;
|
||||
}
|
||||
|
||||
export const useOnboarding = create<OnboardingState>((set) => ({
|
||||
@@ -20,10 +17,4 @@ export const useOnboarding = create<OnboardingState>((set) => ({
|
||||
setPubkey: (pubkey: string) => {
|
||||
set({ pubkey: pubkey });
|
||||
},
|
||||
setPrivkey: (privkey: string) => {
|
||||
set({ privkey: privkey });
|
||||
},
|
||||
clearPrivkey: () => {
|
||||
set({ privkey: '' });
|
||||
},
|
||||
}));
|
||||
|
||||
@@ -1,19 +1,22 @@
|
||||
import { create } from 'zustand';
|
||||
import { createJSONStorage, persist } from 'zustand/middleware';
|
||||
|
||||
interface StrongholdState {
|
||||
password: null | string;
|
||||
privkey: null | string;
|
||||
setPassword: (password: string) => void;
|
||||
setPrivkey: (privkey: string) => void;
|
||||
}
|
||||
|
||||
export const useStronghold = create<StrongholdState>((set) => ({
|
||||
password: null,
|
||||
privkey: null,
|
||||
setPassword: (password: string) => {
|
||||
set({ password: password });
|
||||
},
|
||||
setPrivkey: (privkey: string) => {
|
||||
set({ privkey: privkey });
|
||||
},
|
||||
}));
|
||||
export const useStronghold = create<StrongholdState>()(
|
||||
persist(
|
||||
(set) => ({
|
||||
privkey: null,
|
||||
setPrivkey: (privkey: string) => {
|
||||
set({ privkey: privkey });
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: 'stronghold',
|
||||
storage: createJSONStorage(() => sessionStorage),
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user