Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/haydn/harvester. A tool to display lists of content scraped from the web. harvester.particlesystem.com
Something went wrong. Try again.
12345678910111213141516import * as v from "valibot";import { listSchema } from "@/schemas/listSchema";import type { SourceConfig } from "..";
export const addSource = async (key: string, { arg: source }: { arg: SourceConfig }) => { const current = JSON.parse(localStorage.getItem(key) ?? "[]");
v.assert(listSchema, current);
const value = current ? [...current, source] : [source];
localStorage.setItem(key, JSON.stringify(value));
return value;};