20 lines
No EOL
474 B
TypeScript
20 lines
No EOL
474 B
TypeScript
import {create} from 'zustand'
|
|
import { persist, createJSONStorage } from 'zustand/middleware'
|
|
|
|
interface IpAddressState {
|
|
ipAddress: string;
|
|
setIpAddress: (newIp: string) => void;
|
|
}
|
|
|
|
export const useIpStore = create<IpAddressState>()(
|
|
persist(
|
|
(set)=>({
|
|
ipAddress: '192:168.1.147',
|
|
setIpAddress: (newIp: string) => set({ ipAddress: newIp }),
|
|
}),
|
|
{
|
|
name: 'currentIp-storage',
|
|
storage: createJSONStorage(()=>localStorage)
|
|
}
|
|
)
|
|
) |