refactor localStorage access into localApi