我在我的项目中使用 nextAuth 进行身份验证,我想限制未登录的客户端的某些页面。
我尝试useSession()
在getServerSideProps()
函数中调用挂钩,但是在调用该挂钩时出现错误。
是否可以使用 nextAuth 在服务器端进行重定向?
我想将我的 NextJS 项目推送到 GitHub,但总是收到一条错误消息,指出我的 .next/cache 文件夹超出了 GitHub 的文件大小限制。
我尝试通过将下一个文件夹添加到 .gitignore 文件来解决此问题。
这是我的 .gitignore 文件
node_modules
next
.env
Run Code Online (Sandbox Code Playgroud)
然后我按照以下步骤操作:
.gitignore
在文件中进行更改git rm -r --cached .
命令。git add .
命令git commit -m "Commit message"
或者只是git commit
或者继续工作。git push
但仍然没有成功。
我得到的错误
remote: error: File .next/cache/webpack/client-development/32.pack is 122.93 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File .next/cache/webpack/client-development/71.pack is 126.09 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File …
Run Code Online (Sandbox Code Playgroud) 我这里有这个架构:
model label {
title String @id @db.VarChar(16)
color String @db.VarChar(16)
labelplaylist labelplaylist[]
}
model labelplaylist {
playlistId Int
labelId String @db.VarChar(16)
label label @relation(fields: [labelId], references: [title])
playlist playlist @relation(fields: [playlistId], references: [id])
@@id([playlistId, labelId])
@@index([labelId], name: "labelId")
}
model playlist {
id Int @id @default(autoincrement())
createdAt DateTime? @default(now()) @db.DateTime(0)
title String @db.VarChar(100)
labelplaylist labelplaylist[]
@@index([userId], name: "userId")
}
Run Code Online (Sandbox Code Playgroud)
我只想删除标签和播放列表之间的关系。我尝试这样做:
const deleteRelation = await prisma.labelplaylist.delete({
where: {
playlistId_labelId:
},
})
Run Code Online (Sandbox Code Playgroud)
我有标签和播放列表表的主键,但我不知道如何获取主键=> playlistId_labelId。
谢谢你帮忙。