getdeckname1.js
757 Bytes
const puppeteer=require('puppeteer')
const cheerio=require('cheerio')
const fs=require('fs')
const ejs=require('ejs')
exports.getDeckname=(req,res)=>{
const deckname=req.body.value
const DataCheck=()=>{
return new Promise((resolve,reject)=>{
if(!deckname){
reject(({
query:'request_body_error'
}))
}
else resolve()
})
}
const Set=()=>{
req.session.deckname=req.body.value
return
}
DataCheck()
.then(Set)
.then(()=>{
res.status(200).json({message:'complete setting opponent class'})
})
.catch((err)=>{
res.status(500).json(err||err.message)
})
}