getdeckname1.js 793 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)
        })
}