Fix visitor limit check
This commit is contained in:
@@ -7,7 +7,9 @@ client
|
|||||||
.setEndpoint(
|
.setEndpoint(
|
||||||
(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string).replace(
|
(process.env["NEXT_PUBLIC_APPWRITE_HOST"] as string).replace(
|
||||||
"localhost",
|
"localhost",
|
||||||
"host.docker.internal"
|
process.env.NODE_ENV == "production"
|
||||||
|
? "host.docker.internal"
|
||||||
|
: "localhost"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
.setProject("pingvin-share")
|
.setProject("pingvin-share")
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const checkSecurity = async (
|
|||||||
.getDocument<SecurityDocument>("shareSecurity", shareDocument.securityID)
|
.getDocument<SecurityDocument>("shareSecurity", shareDocument.securityID)
|
||||||
.then((securityDocument) => {
|
.then((securityDocument) => {
|
||||||
if (securityDocument.maxVisitors) {
|
if (securityDocument.maxVisitors) {
|
||||||
if (shareDocument.visitorCount > securityDocument.maxVisitors) {
|
if (shareDocument.visitorCount >= securityDocument.maxVisitors) {
|
||||||
throw "visitor_limit_exceeded";
|
throw "visitor_limit_exceeded";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user