// 本地存储工具

export const storage = {
  get(key: string) {
    const value = localStorage.getItem(key)
    if (!value) return null
    try {
      return JSON.parse(value)
    } catch {
      return value
    }
  },
  
  set(key: string, value: any) {
    localStorage.setItem(key, JSON.stringify(value))
  },
  
  remove(key: string) {
    localStorage.removeItem(key)
  },
  
  clear() {
    localStorage.clear()
  }
}
