정리
This commit is contained in:
@@ -34,6 +34,8 @@ interface KisRuntimeStoreState {
|
||||
|
||||
wsApprovalKey: string | null;
|
||||
wsUrl: string | null;
|
||||
|
||||
_hasHydrated: boolean;
|
||||
}
|
||||
|
||||
interface KisRuntimeStoreActions {
|
||||
@@ -48,6 +50,7 @@ interface KisRuntimeStoreActions {
|
||||
invalidateKisVerification: () => void;
|
||||
clearKisRuntimeSession: (tradingEnv: KisTradingEnv) => void;
|
||||
getOrFetchWsConnection: () => Promise<KisWsConnection | null>;
|
||||
setHasHydrated: (state: boolean) => void;
|
||||
}
|
||||
|
||||
const INITIAL_STATE: KisRuntimeStoreState = {
|
||||
@@ -60,6 +63,7 @@ const INITIAL_STATE: KisRuntimeStoreState = {
|
||||
tradingEnv: "real",
|
||||
wsApprovalKey: null,
|
||||
wsUrl: null,
|
||||
_hasHydrated: false,
|
||||
};
|
||||
|
||||
const RESET_VERIFICATION_STATE = {
|
||||
@@ -173,10 +177,18 @@ export const useKisRuntimeStore = create<
|
||||
|
||||
return wsConnectionPromise;
|
||||
},
|
||||
setHasHydrated: (state) => {
|
||||
set({
|
||||
_hasHydrated: state,
|
||||
});
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: "autotrade-kis-runtime-store",
|
||||
storage: createJSONStorage(() => localStorage),
|
||||
onRehydrateStorage: () => (state) => {
|
||||
state?.setHasHydrated(true);
|
||||
},
|
||||
partialize: (state) => ({
|
||||
kisTradingEnvInput: state.kisTradingEnvInput,
|
||||
kisAppKeyInput: state.kisAppKeyInput,
|
||||
|
||||
Reference in New Issue
Block a user