fix blitz.config.ts

This commit is contained in:
m5r
2021-08-03 20:02:01 +08:00
parent 2cf53533a3
commit 95f283017d
3 changed files with 16 additions and 14 deletions

View File

@ -1,8 +1,8 @@
import { Ctx } from "blitz";
import { resolver } from "blitz";
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;
return db.customer.findFirst({
@ -18,4 +18,4 @@ export default async function getCurrentCustomer(_ = null, { session }: Ctx) {
user: true,
},
});
}
});