Skip to content

Commit

Permalink
remove fluff
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnmclean committed Jun 2, 2024
1 parent e7cb5d7 commit 3a85f0c
Show file tree
Hide file tree
Showing 55 changed files with 77 additions and 5,971 deletions.
28 changes: 14 additions & 14 deletions app/modules/auth/auth.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,20 @@ authenticator.use(
})

if (!user) {
user = await prisma.user.create({
data: {
roles: { connect: [{ name: 'user' }] },
email,
},
include: {
image: { select: { id: true } },
roles: {
select: {
name: true,
},
},
},
})
// user = await prisma.user.create({
// data: {
// roles: { connect: [{ name: 'user' }] },
// email,
// },
// include: {
// image: { select: { id: true } },
// roles: {
// select: {
// name: true,
// },
// },
// },
// })
if (!user) throw new Error(ERRORS.AUTH_USER_NOT_CREATED)
}

Expand Down
4 changes: 2 additions & 2 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useForm, getFormProps } from '@conform-to/react'
import { parseWithZod } from '@conform-to/zod'
import { invariantResponse } from '@epic-web/invariant'
import { AuthenticityTokenProvider } from 'remix-utils/csrf/react'
import {
json,
type LoaderFunctionArgs,
Expand All @@ -26,8 +25,10 @@ import {
} from '@remix-run/react'
import { withSentry } from '@sentry/remix'
import { useRef } from 'react'
import { AuthenticityTokenProvider } from 'remix-utils/csrf/react'
import { HoneypotProvider } from 'remix-utils/honeypot/react'
import { z } from 'zod'
import { csrf } from '#app/utils/csrf.server'
import { GeneralErrorBoundary } from './components/error-boundary.tsx'
import { EpicProgress } from './components/progress-bar.tsx'
import { SearchBar } from './components/search-bar.tsx'
Expand Down Expand Up @@ -55,7 +56,6 @@ import { type Theme, setTheme, getTheme } from './utils/theme.server.ts'
import { makeTimings, time } from './utils/timing.server.ts'
import { getToast } from './utils/toast.server.ts'
import { useOptionalUser, useUser } from './utils/user.ts'
import { csrf } from '#app/utils/csrf.server'

export const links: LinksFunction = () => {
return [
Expand Down
14 changes: 14 additions & 0 deletions app/routes/_auth+/$provider.callback.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { type LoaderFunctionArgs } from '@remix-run/node'
import { authenticator } from '#app/modules/auth/auth.server'
import { ROUTE_PATH as LOGIN_PATH } from '#app/routes/_auth+/login'

export const ROUTE_PATH = '/auth/:provider/callback' as const

export async function loader({ request, params }: LoaderFunctionArgs) {
if (typeof params.provider !== 'string') throw new Error('Invalid provider.')

return authenticator.authenticate(params.provider, request, {
successRedirect: '/',
failureRedirect: LOGIN_PATH,
})
}
15 changes: 15 additions & 0 deletions app/routes/_auth+/$provider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { type ActionFunctionArgs, redirect } from '@remix-run/node'

import { authenticator } from '#app/modules/auth/auth.server'
import { ROUTE_PATH as LOGIN_PATH } from '#app/routes/_auth+/login'

export const ROUTE_PATH = '/auth/:provider' as const

export async function loader() {
return redirect(LOGIN_PATH)
}

export async function action({ request, params }: ActionFunctionArgs) {
if (typeof params.provider !== 'string') throw new Error('Invalid provider.')
return authenticator.authenticate(params.provider, request)
}
259 changes: 0 additions & 259 deletions app/routes/_auth+/auth.$provider.callback.test.ts

This file was deleted.

Loading

0 comments on commit 3a85f0c

Please sign in to comment.