page-assist/src/utils/verify-page-share.ts
2024-03-23 14:44:05 +05:30

10 lines
306 B
TypeScript

import { cleanUrl } from "~/libs/clean-url"
export const verifyPageShareURL = async (url: string) => {
const res = await fetch(`${cleanUrl(url)}/api/v1/ping`)
if (!res.ok) {
throw new Error("Unable to verify page share")
}
const data = await res.text()
return data === "pong"
}