From a03794c88a586278f6d870d1cc41042ddb1b5083 Mon Sep 17 00:00:00 2001 From: SoJS coder <77751154+sojs-coder@users.noreply.github.com> Date: Tue, 24 Jan 2023 21:04:23 +0000 Subject: [PATCH] fixed post request --- index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index dd98468..c194c9d 100644 --- a/index.js +++ b/index.js @@ -1,16 +1,18 @@ const fetch = require("node-fetch"); -async function postData(data = {}) { - const url = "https://soauth.sojs.repl.co/checkValid"; +async function postData(url = '', data = {}) { + const response = await fetch(url, { method: 'POST', + mode: "cors", headers: { - 'Content-Type': 'application/json' + "Content-Type": "application/json", + "Access-Control-Allow-Origin": "*" }, - referrerPolicy: 'no-referrer', body: JSON.stringify(data) }); - return response.json(); + + return response.json() } function soauth(req,res,next){ if(!req.so_auth){