e2814943e9
* [feature] grids * Shows relative grids at different zoom levels * Update colors * Restores vec and intersect to monorepo, changes vec.round to vec.toFixed, adds vec.snap * Snapping in translate and transforms, fix shortcut * fix bugs in build * use grid size for nudge too * update scripts * Update grid.tsx * Update grid.tsx * Fixed! * Update grid.tsx * Fix package imports * Update Editor.tsx * Improve tsconfigs, imports * Fix tiny arrow bugs, snap starting points to grid * Update tsconfig.base.json * Update shape-styles.ts * Fix example tsconfig * Fix translate type error * Fix types, paths Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
35 lines
887 B
TypeScript
35 lines
887 B
TypeScript
import { isSponsoringMe } from 'utils/isSponsoringMe'
|
|
import type { NextApiHandler, NextApiRequest, NextApiResponse } from 'next'
|
|
import NextAuth from 'next-auth'
|
|
import Providers from 'next-auth/providers'
|
|
|
|
export default function Auth(
|
|
req: NextApiRequest,
|
|
res: NextApiResponse
|
|
): ReturnType<NextApiHandler> {
|
|
return NextAuth(req, res, {
|
|
providers: [
|
|
Providers.GitHub({
|
|
clientId: process.env.GITHUB_ID,
|
|
clientSecret: process.env.GITHUB_SECRET,
|
|
scope: 'read:user',
|
|
}),
|
|
],
|
|
callbacks: {
|
|
async redirect(url, baseUrl) {
|
|
return baseUrl
|
|
},
|
|
async signIn(user, account, profile: { login?: string }) {
|
|
if (profile?.login) {
|
|
const canLogin = await isSponsoringMe(profile.login)
|
|
|
|
if (canLogin) {
|
|
return canLogin
|
|
}
|
|
}
|
|
|
|
return '/'
|
|
},
|
|
},
|
|
})
|
|
}
|