login.js 609 B

123456789101112131415161718192021222324252627282930
  1. const Parse = require("parse/node");
  2. Parse.serverURL = "http://web2023.fmode.cn:9999/parse"; // 配置服务器地址
  3. Parse.initialize("dev"); // 配置应用名称
  4. async function login_user(usr) {
  5. if (!usr?.account) {
  6. throw "账户不存在"
  7. }
  8. try {
  9. let current = Parse.User.logIn(usr.account, usr.password);
  10. if (usr?.account) {
  11. // await this.route.navigate(['/home']);
  12. console.log(current)
  13. } else {
  14. throw "账号或者密码有误"
  15. }
  16. } catch (e) {
  17. throw e
  18. }
  19. }
  20. login_user({
  21. account: "1",
  22. password: "12",
  23. })
  24. module.exports.login_user = login_user