Update the starter to work, current starter doesn't work (#160)

This commit is contained in:
Rohith Gilla
2021-07-25 21:31:31 +05:30
committed by GitHub
parent a71ae6697b
commit e14476402e
6 changed files with 1214 additions and 1549 deletions

View File

@@ -5,9 +5,9 @@ import {
AuthenticationError,
AuthorizationError,
ErrorFallbackProps,
useQueryErrorResetBoundary,
} from "blitz"
import { ErrorBoundary } from "react-error-boundary"
import { queryCache } from "react-query"
import LoginForm from "app/auth/components/LoginForm"
export default function App({ Component, pageProps }: AppProps) {
@@ -18,11 +18,9 @@ export default function App({ Component, pageProps }: AppProps) {
<ErrorBoundary
FallbackComponent={RootErrorFallback}
resetKeys={[router.asPath]}
onReset={() => {
// This ensures the Blitz useQuery hooks will automatically refetch
// data any time you reset the error boundary
queryCache.resetErrorBoundaries()
}}
// This ensures the Blitz useQuery hooks will automatically refetch
// data any time you reset the error boundary
onReset={useQueryErrorResetBoundary().reset}
>
{getLayout(<Component {...pageProps} />)}
</ErrorBoundary>

View File

@@ -1,9 +1,10 @@
const { sessionMiddleware, simpleRolesIsAuthorized } = require("@blitzjs/server")
import { BlitzConfig, sessionMiddleware, simpleRolesIsAuthorized } from "blitz"
module.exports = {
const config: BlitzConfig = {
middleware: [
sessionMiddleware({
isAuthorized: simpleRolesIsAuthorized,
cookiePrefix: "blitz", // Use your app name here
}),
],
/* Uncomment this to customize the webpack config
@@ -15,3 +16,5 @@ module.exports = {
},
*/
}
module.exports = config

View File

@@ -12,6 +12,9 @@
"test": "jest",
"test:watch": "jest --watch"
},
"engines": {
"node": "14.15.0"
},
"prisma": {
"schema": "db/schema.prisma"
},
@@ -27,9 +30,9 @@
"dependencies": {
"prisma": "~2.17",
"@prisma/client": "~2.17",
"blitz": "0.30.1",
"react": "0.0.0-experimental-3310209d0",
"react-dom": "0.0.0-experimental-3310209d0",
"blitz": "0.38.5",
"react": "alpha",
"react-dom": "alpha",
"react-error-boundary": "3.1.0",
"typescript": "4.1.5",
"zod": "1.11.11",

View File

@@ -1,5 +1,4 @@
import { DefaultCtx, SessionContext } from "blitz"
import { SimpleRolesIsAuthorized } from "@blitzjs/server"
import { DefaultCtx, SessionContext, SimpleRolesIsAuthorized } from "blitz"
import { User } from "db"
// Note: You should switch to Postgres and then use a DB enum for role type

File diff suppressed because it is too large Load Diff

10
examples/node_modules/.yarn-integrity generated vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"systemParams": "darwin-x64-83",
"modulesFolders": [],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [],
"lockfileEntries": {},
"files": [],
"artifacts": {}
}