studiocms
Version:
Astro Native CMS for AstroDB. Built from the ground up by the Astro community.
18 lines (17 loc) • 585 B
JavaScript
import { AstroError } from "astro/errors";
import { Data, Effect } from "./effect.js";
class ValidateAuthCodeError extends Data.TaggedError("ValidateAuthCodeError") {
}
const getUrlParam = ({ url }, name) => Effect.try({
try: () => url.searchParams.get(name),
catch: () => new AstroError("Failed to parse URL from Astro context")
});
const getCookie = ({ cookies }, key) => Effect.try({
try: () => cookies.get(key)?.value ?? null,
catch: () => new AstroError("Failed to parse get Cookies from Astro context")
});
export {
ValidateAuthCodeError,
getCookie,
getUrlParam
};