const SHOWS = 'pod_shows';

export const saveShow  = (showData) => {
  const shows = getShows();
  const show = shows.find((s) => s.id === showData.id);
  if(show) {
    // we already have show - update?
    console.warn('show already in list...');
  } else {
    shows.push(showData);
  }
  localStorage.setItem(SHOWS, JSON.stringify(shows));
};

export const getShows = () => {
  const showData = localStorage.getItem(SHOWS);
  return showData ? JSON.parse(showData) : [];
};

export const getShow = (id) => {
  const shows = getShows();
  return shows.find((s) => s.id === id);
};

@@ -19,16 +19,57 @@
 _shows';
+%0Aconst SEARCH_RESULTS = 'search_results';
 %0A%0Aexport
@@ -614,12 +614,343 @@
 === id);%0A%7D;%0A
+%0A%0Aexport const setSearchResults = (results) =%3E %7B%0A  const dataStr = JSON.stringify(results %7C%7C %5B%5D);%0A  localStorage.setItem(SEARCH_RESULTS, dataStr);%0A%7D;%0A%0Aexport const getSearchResult = (feedUrl) =%3E %7B%0A  const results = JSON.parse(localStorage.getItem(SEARCH_RESULTS) %7C%7C '%5B%5D');%0A  return results.find(pod =%3E pod.feedUrl === feedUrl);%0A%7D;%0A

extend with search results