export const getLocalStorage = (key: string) => {
  try {
    const data = localStorage?.getItem(key);
    return data ? JSON.parse(data) : null;
  } catch (error) {
    console.error("Error parsing JSON from localStorage", error);
    return null;
  }
};

export const setLocalStorage = (key: string, data: any) => {
  try {
    const jsonData = JSON.stringify(data);
    localStorage.setItem(key, jsonData);
  } catch (error) {
    console.error("Error stringify data for localStorage", error);
  }
};
