fix blitz.config.ts
This commit is contained in:
parent
2cf53533a3
commit
95f283017d
@ -1,8 +1,8 @@
|
|||||||
import { Ctx } from "blitz";
|
import { resolver } from "blitz";
|
||||||
|
|
||||||
import db from "../../../db";
|
import db from "../../../db";
|
||||||
|
|
||||||
export default async function getCurrentCustomer(_ = null, { session }: Ctx) {
|
export default resolver.pipe(resolver.authorize(), async (_ = null, { session }) => {
|
||||||
if (!session.userId) return null;
|
if (!session.userId) return null;
|
||||||
|
|
||||||
return db.customer.findFirst({
|
return db.customer.findFirst({
|
||||||
@ -18,4 +18,4 @@ export default async function getCurrentCustomer(_ = null, { session }: Ctx) {
|
|||||||
user: true,
|
user: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
@ -2,7 +2,7 @@ import { BlitzConfig, sessionMiddleware, simpleRolesIsAuthorized } from "blitz";
|
|||||||
|
|
||||||
const withPWA = require("next-pwa");
|
const withPWA = require("next-pwa");
|
||||||
|
|
||||||
export const config: BlitzConfig = {
|
const config: BlitzConfig = {
|
||||||
middleware: [
|
middleware: [
|
||||||
sessionMiddleware({
|
sessionMiddleware({
|
||||||
cookiePrefix: "virtual-phone-blitz",
|
cookiePrefix: "virtual-phone-blitz",
|
||||||
@ -47,7 +47,8 @@ export const config: BlitzConfig = {
|
|||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
export default process.env.NODE_ENV === "test"
|
module.exports =
|
||||||
|
process.env.NODE_ENV === "test"
|
||||||
? config
|
? config
|
||||||
: withPWA({
|
: withPWA({
|
||||||
...config,
|
...config,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { setConfig } from "blitz";
|
import { setConfig } from "blitz";
|
||||||
|
|
||||||
import { config } from "../blitz.config";
|
// see https://github.com/vercel/next.js/issues/4024
|
||||||
|
const config = require("../blitz.config");
|
||||||
|
|
||||||
setConfig({
|
setConfig({
|
||||||
serverRuntimeConfig: config.serverRuntimeConfig,
|
serverRuntimeConfig: config.serverRuntimeConfig,
|
||||||
|
Loading…
Reference in New Issue
Block a user