拒绝获取不安全的标头“ x-parse-job-status-id”-Vue.js和Parse Server

时间:2018-08-08 08:31:47

标签: heroku vue.js parse-server

经过数月的努力,现在尝试进行登录时,出现此错误。出现错误时,显示的代码将简化为“ Parse.User.logIn”。这里也有一些类似的问题,但是它们都与CORS有关,它在本地服务器上可以正常运行,但是在我们托管时,它不会返回数据并在控制台中显示错误为:

`    Clud-Code>
  Parse.Cloud.define("allUser", function (req, res) {

  var maxLevel, maxSponsor, topUser;
  var max = [];
  var topUserCount = 0;
 var lastPayOut = [];
var connector = [];
  var dataUT = [];
  let UserTrack = Parse.Object.extend("UserTrack");
   let UserDetails = Parse.Object.extend("UserDetails");

  let Scheme = Parse.Object.extend("Scheme");
  let SchemeRule = Parse.Object.extend("SchemeRule");
 let qS = new Parse.Query(Scheme);

  qS.equalTo("status", true);
     qS.first().then((qSresult) => {
    var currentScheme = new Scheme();
   currentScheme.id = qSresult.id;
    let qSR = new Parse.Query(SchemeRule);
       qSR.equalTo("scheme", currentScheme);
              qSR.find().then((qSRresult) => {
            for (let sr = qSRresult.length; sr <= qSRresult.length; sr++) {
              maxLevel = qSRresult[sr - 1].get("level");
                // maxTeam=qSRresult[sr].get("teamCount");
               maxSponsor = qSRresult[sr - 1].get("sponsorCount");
                 // var maxAmount=qSRresult[sr].get("level");
                }
           let obj = {
            maxLevel,
                maxSponsor
              }
                  max.push(obj);
                 var level, team, joinee, repurchase, active;
               let qUT = new Parse.Query(UserTrack);
  qUT.descending("createdAt")
             qUT.find().then((qUTresult) => {
                 for (let i of qUTresult) {
                     level = i.get("level");
                    team = i.get("team");
                    joinee = i.get("sponsored");
                 repurchase = i.get("repurchase");
                    active = i.get("Active");
                  //top user logic
                     if ((level < max[0].maxLevel) && (joinee >= 
                       max[0].maxSponsor)) {
        topUserCount = topUserCount + 1;
      }
      let obj = {
        id: i.get("user").id,
        date: i.get("createdAt"),
        level: level,
        // connector:qUDresult.get("connector").id,
        team: team,
        joinee: joinee,
        repurchase: repurchase,
        //   lastPayOut:lastPayOut,
        active: active
      }
      dataUT.push(obj);
      topUser = topUserCount;
    }
  }).then(() => {
    let qUD = new Parse.Query(UserDetails);
    qUD.descending("createdAt");
    qUD.find().then((qUDresult) => {
      for (let l = 0; l <= qUDresult.length - 1; l++) {

        let connectorU = qUDresult[l].get("connector").id;
        let uId = qUDresult[l].get("user").id;
        let objc = {

          connector: connectorU,
          uId: uId,
          id: dataUT[l].id,
          date: dataUT[l].date,
          level: dataUT[l].level,
          team: dataUT[l].team,
          joinee: dataUT[l].joinee,
          repurchase: dataUT[l].repurchase,
          active: dataUT[l].active
        }
        connector.push(objc);
      }
      //totalUser
      var totalUser = connector.length;
      var data = [connector, totalUser, topUser];
      console.log(data);
      res.success(data);

    })
  })

  })
})
})


clien-side code->
Parse.User.logIn("ac0427d", "abcd1234");
 Parse.Cloud.run('allUser', {

 }).then((result) => {
 console.log(result);
}).catch((err) => {
 console.log(err);
 });
`

1 个答案:

答案 0 :(得分:0)

您可能正在使用新版本的SDK(2.0.0),与1.x相比,它包含许多重大更改,而尚不知道。

有两种方法可以解决此问题: