1 line
1.3 KiB
JavaScript
1 line
1.3 KiB
JavaScript
"use strict";(()=>{var e={};e.id=6298,e.ids=[6298],e.modules={75600:e=>{e.exports=require("next/dist/compiled/next-server/pages-api.runtime.prod.js")},72583:e=>{e.exports=require("sanitize-html")},9973:e=>{e.exports=require("serverless-mysql")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},21407:(e,r,s)=>{s.r(r),s.d(r,{config:()=>p,default:()=>o,routeModule:()=>m});var i={};s.r(i),s.d(i,{default:()=>d});var a=s(89947),t=s(2706),u=s(96762),l=s(98e3),n=s(48786);async function d(e,r){if("POST"!==e.method)return r.json({msg:"Failed!"});let{email:s,alerts:i,userId:a}=e.body;if(i)i&&await (0,n.A)("DELETE FROM unsubscribes WHERE email=? AND type='alerts'",[s]);else{let e=await (0,n.A)("SELECT email FROM unsubscribes WHERE email=? AND type='alerts'",[s]);e&&e[0]||await (0,l.A)({dbFullName:"datasquirel",tableName:"unsubscribes",data:{email:s,type:"alerts",user_id:a||null}})}r.json({success:!0})}let o=(0,u.M)(i,"default"),p=(0,u.M)(i,"config"),m=new a.PagesAPIRouteModule({definition:{kind:t.A.PAGES_API,page:"/api/unsubscribe",pathname:"/api/unsubscribe",bundlePath:"",filename:""},userland:i})}};var r=require("../../webpack-api-runtime.js");r.C(e);var s=e=>r(r.s=e),i=r.X(0,[1251],()=>s(21407));module.exports=i})(); |