Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

305
Visualizações
Parse User.login() is not returning the user (JS SDK)

So I am calling the Parse.User.login() method. If the username/password combination are not correct, I get the corresponding error from parse. If if I am entering the correct ones, noting happens. Does anybody knows why?

This is my code

const ParsePlattform = require('parse/node')

export function initializeParseConnection() {
  ParsePlattform.initialize(parseAppId, javaScriptKey)
  ParsePlattform.serverURL = 'http://localhost:1337/parse'

  return ParsePlattform
}

export function userLogin(username, password) {
  return new Promise(function (resolve, reject) {
    const parse = initializeParseConnection()

    parse.User.logIn(username, password, {
      success: (user) => {
        // console.log will not even be triggered
        console.log('triggered')
        resolve(user)
      },
      error: (user, error) => {
        // this gets triggered if I enter incorrect user/password combination
        console.error('Error: ' + error.code + ' ' + error.message)
        reject(error)
      },
    })
  })
}

I call this function from a nuxt project/vue page

<template>
  <main class="form-signin">
    <form>
      <div class="form-floating">
        <input
          type="text"
          v-model="username"
        />
        <label for="floatingInput">Benutzername</label>
      </div>
      <div class="form-floating">
        <input
          type="password"
          class="form-control"
          v-model="password"
        />
      </div>

   
      <button @click="login" class="w-100 btn btn-lg btn-primary">Login</button>
    </form>
  </main>
</template>

<script>
import { userLogin } from 'assets/js/parse'

export default {
  name: 'Login',
  layout: 'login',
  data() {
    return {
      password: null,
      username: null,
    }
  },
  methods: {
    async login() {
      const user = await userLogin(this.username, this.password)
    },
  },
}
</script>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

try with:

export async function userLogin(username, password) {
    const parse = initializeParseConnection()

    try {
        const user = await parse.User.logIn(username, password)
        console.log('triggered')
        return user
    } catch (error) {
        console.error('Error: ' + error.code + ' ' + error.message)
        throw error;
    }
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda