update stronghold
This commit is contained in:
+15
-12
@@ -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