mirror of
https://github.com/System-End/site.git
synced 2026-04-19 22:05:11 +00:00
Check if complete duplicate
This commit is contained in:
parent
a5c76dc272
commit
5517e7678d
1 changed files with 4 additions and 3 deletions
|
|
@ -11,7 +11,7 @@ export default async (req, res) => {
|
|||
if (req.method === 'POST') {
|
||||
const data = JSON.parse(req.body)
|
||||
|
||||
const exists = await isDuplicate(data.name)
|
||||
const exists = await isDuplicate(data.name, data.email, data.reason)
|
||||
const empty = await isEmpty(data)
|
||||
|
||||
if (!exists && !empty) {
|
||||
|
|
@ -26,9 +26,10 @@ export default async (req, res) => {
|
|||
}
|
||||
}
|
||||
|
||||
async function isDuplicate(name, email, teen, reason) {
|
||||
async function isDuplicate(name, email, reason) {
|
||||
reason = reason.replace(`'`, `\\'`)
|
||||
const exists = await joinTable.read({
|
||||
filterByFormula: `AND({Full Name} = '${name}', {Email Address} = '${email}', {Studnet} = '${teen}', {Reason} = '${reason}')`
|
||||
filterByFormula: `AND({Full Name} = '${name}', {Email Address} = '${email}', Reason = '${reason}')`
|
||||
})
|
||||
return typeof exists[0] !== 'undefined'
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue