@coursebuilder/core
Version:
Core package for Course Builder
32 lines (30 loc) • 766 B
JavaScript
import {
__name
} from "./chunk-VLQXSCFN.js";
// src/lib/actions/user-lookup.ts
async function userLookup(request, cookies, options) {
if (!options.adapter)
throw new Error("Adapter not found");
if (request.headers?.["x-skill-secret"] !== process.env.SKILL_SECRET) {
return {
status: 401,
body: "unauthorized"
};
}
try {
const email = request.query?.email || request.body?.email;
const user = await options.adapter.getUserWithPurchasersByEmail(email);
return {
status: 200,
body: JSON.stringify(user)
};
} catch (e) {
console.log("error", e);
throw new Error("unable-to-lookup-user");
}
}
__name(userLookup, "userLookup");
export {
userLookup
};
//# sourceMappingURL=chunk-WY77I7D6.js.map