{"size": 662, "ext": "js", "max_stars_repo_path": "src/localstorage.js", "max_stars_repo_name": "pipe2442/todoList-javascript", "max_stars_repo_stars_event_min_datetime": "2021-07-13T14:19:46.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-13T14:19:46.000Z", "max_issues_repo_path": "src/localstorage.js", "max_issues_repo_name": "errea/todo-list-js", "max_issues_repo_issues_event_min_datetime": "2021-06-18T16:14:23.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-13T14:21:39.000Z", "max_forks_repo_path": "src/localstorage.js", "max_forks_repo_name": "pipe2442/todoList-javascript", "max_forks_repo_forks_event_min_datetime": "2021-06-25T03:35:10.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-13T14:19:37.000Z"}
{"max_stars_count": 1, "max_issues_count": 2, "max_forks_count": 2, "avg_line_length": 30.0909090909, "max_line_length": 73, "alphanum_fraction": 0.6963746224}
/* eslint-disable import/no-cycle */
import { projectList, projectDomLocal, Project } from './newproject';

const saveLocalstorage = () => {
  localStorage.setItem('ListaDeProyectos', JSON.stringify(projectList));
};

const getLocalstorage = () => {
  if (localStorage.getItem('ListaDeProyectos')) {
    const getTask = JSON.parse(localStorage.getItem('ListaDeProyectos'));
    getTask.forEach((t) => {
      projectList.push(t);
      projectDomLocal(t);
    });
  } else {
    const defaultProject = new Project('Default Project');
    projectList.push(defaultProject);
    projectDomLocal(defaultProject);
  }
};

export { saveLocalstorage, getLocalstorage };