Skip to content

Commit 67801ec

Browse files
committed
update remix to new v3 flags
1 parent 8543d84 commit 67801ec

File tree

57 files changed

+135
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+135
-163
lines changed

remix/REMOVEremix.config.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

remix/app/routes/_products-layout.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { json } from '@remix-run/node'
21
import { Outlet, useLoaderData } from '@remix-run/react'
32
import { getBrands, getCategories, getProducts } from '~/utils/db.server'
43
import { sortLabel } from '~/utils/helpers'
@@ -19,11 +18,11 @@ export const loader = async ({ request }: LoaderFunctionArgs) => {
1918
getCategories(),
2019
])
2120

22-
return json({
21+
return {
2322
products,
2423
brands: brands.sort(sortLabel),
2524
categories: categories.sort(sortLabel),
26-
})
25+
}
2726
}
2827

2928
export default function () {

remix/app/routes/login.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from 'react'
22
import * as z from 'zod'
3-
import { json } from '@remix-run/node'
3+
import { data } from '@remix-run/node'
44
import { Form, Link, useActionData } from '@remix-run/react'
55
import { createUserSession, verifyUser } from '~/utils/auth.server'
66
import { FieldWrap } from '~/components/FormFields'
@@ -21,11 +21,11 @@ export async function action({ request }: ActionFunctionArgs) {
2121
const formData = await request.formData()
2222
const formValues = Object.fromEntries(formData)
2323
const results = formSchema.safeParse(formValues)
24-
if (!results.success) return json({ error: 'Invalid Data' }, { status: 400 })
24+
if (!results.success) return data({ error: 'Invalid Data' }, { status: 400 })
2525

2626
const { username, password } = results.data
2727
const userId = await verifyUser(username, password)
28-
if (!userId) return json({ error: 'User not found' }, { status: 400 })
28+
if (!userId) return data({ error: 'User not found' }, { status: 400 })
2929

3030
return createUserSession(userId, '/')
3131
}

remix/app/routes/register.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useState } from 'react'
22
import * as z from 'zod'
3-
import { json } from '@remix-run/node'
3+
import { data } from '@remix-run/node'
44
import { Form, useActionData, Link } from '@remix-run/react'
55
import { createUserSession, registerUser } from '~/utils/auth.server'
66
import { usernameExists } from '~/utils/db.server'
@@ -22,14 +22,14 @@ export async function action({ request }: ActionFunctionArgs) {
2222
const formData = await request.formData()
2323
const formValues = Object.fromEntries(formData)
2424
const results = formSchema.safeParse(formValues)
25-
if (!results.success) return json({ error: 'Invalid Data' }, { status: 400 })
25+
if (!results.success) return data({ error: 'Invalid Data' }, { status: 400 })
2626

2727
const { username, password } = results.data
2828
const userExists = await usernameExists(username)
29-
if (userExists) return json({ error: 'Username already registered' }, { status: 400 })
29+
if (userExists) return data({ error: 'Username already registered' }, { status: 400 })
3030

3131
const userId = await registerUser(username, password)
32-
if (!userId) return json({ error: 'We were not able to register this user' }, { status: 400 })
32+
if (!userId) return data({ error: 'We were not able to register this user' }, { status: 400 })
3333

3434
return createUserSession(userId, '/')
3535
}

remix/lessons/01-routes-and-layouts/lecture/root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react'
22
import { LinksFunction } from '@remix-run/node'
3-
import stylesheet from '~/styles/app.css'
3+
import stylesheet from '~/styles/app.css?url'
44

55
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: stylesheet }]
66

remix/lessons/01-routes-and-layouts/practice-final/root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react'
22
import { LinksFunction } from '@remix-run/node'
3-
import stylesheet from '~/styles/app.css'
3+
import stylesheet from '~/styles/app.css?url'
44
import { MainLayout } from './components/MainLayout'
55

66
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: stylesheet }]

remix/lessons/01-routes-and-layouts/practice/root.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from '@remix-run/react'
22
import { LinksFunction } from '@remix-run/node'
3-
import stylesheet from '~/styles/app.css'
3+
import stylesheet from '~/styles/app.css?url'
44
import { MainLayout } from './components/MainLayout'
55

66
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: stylesheet }]

remix/lessons/02-loaders/lecture/NOTES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
```ts
99
// These are same
10-
return json({ user: 'brad' })
10+
return { user: 'brad' }
1111

1212
return new Response(JSON.stringify({ user: 'brad' }), {
1313
headers: {

remix/lessons/02-loaders/lecture/root.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import { Links, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData } from '@remix-run/react'
2-
import { type LinksFunction, json } from '@remix-run/node'
3-
import stylesheet from '~/styles/app.css'
2+
import { type LinksFunction } from '@remix-run/node'
3+
import stylesheet from '~/styles/app.css?url'
44
import { MainLayout } from './components/MainLayout'
55
import { LessonProvider } from '~/state/LessonContext'
66

77
export const links: LinksFunction = () => [{ rel: 'stylesheet', href: stylesheet }]
88

99
export async function loader() {
1010
const lesson = process.env.REMIX_APP_DIR?.split('/').slice(-2).join('/') || ''
11-
return json({ lesson })
11+
return { lesson }
1212
}
1313

1414
export default function App() {

remix/lessons/02-loaders/lecture/routes/$productId.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LoaderFunctionArgs, json } from '@remix-run/node'
1+
import { LoaderFunctionArgs } from '@remix-run/node'
22
import { useLoaderData } from '@remix-run/react'
33
import { ProductType } from '~/utils/db.server'
44

0 commit comments

Comments
 (0)