UNPKG

@restnfeel/agentc-starter-kit

Version:

한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템

39 lines (37 loc) 1.22 kB
// Helper function to convert NextAuth user to our User type const convertNextAuthUser = (nextAuthUser) => { if (!nextAuthUser) return null; return { id: nextAuthUser.id || "", email: nextAuthUser.email || "", name: nextAuthUser.name || "", avatar_url: nextAuthUser.image, role: "customer", // Default role, can be customized created_at: new Date().toISOString(), updated_at: new Date().toISOString(), }; }; // NextAuth adapter for AuthProvider const createNextAuthAdapter = (nextAuth) => { if (!nextAuth) { console.warn("NextAuth not provided to adapter"); return {}; } return { getSession: async () => { const session = await nextAuth.getSession(); return { user: convertNextAuthUser(session === null || session === void 0 ? void 0 : session.user), }; }, signInAdapter: async (provider, options) => { await nextAuth.signIn(provider, options); }, signOutAdapter: async () => { await nextAuth.signOut(); }, }; }; export { createNextAuthAdapter }; //# sourceMappingURL=nextauth.js.map