export const AUTH_STORAGE_KEY = 'wangpan-auth-v1'
export const AUTH_SESSION_STORAGE_KEY = 'wangpan-auth-session-v1'
export const DASHBOARD_STORAGE_KEY = 'wangpan-dashboard-v1'
export const COLUMN_STORAGE_KEY = 'wangpan-columns-v1'

export function readStorage(key, fallback) {
  try {
    const raw = localStorage.getItem(key)
    return raw ? JSON.parse(raw) : fallback
  } catch {
    return fallback
  }
}

export function writeStorage(key, value) {
  localStorage.setItem(key, JSON.stringify(value))
}

export function removeStorage(key) {
  localStorage.removeItem(key)
}
