angularjs 为什么登录后不导航到 Jmeter 板页面

zyfwsgd6  于 11个月前  发布在  Angular
关注(0)|答案(1)|浏览(95)
id: any;
loginsubmit(id: any) {
console.log("button works");
const che = \[\];
this.admincreation.getdatas(id).subscribe((che: any) =\> {
{
const adminl = che.find((b: any) =\> {
return b.loginemail === this.Login.value.loginemail && b.loginpassword  ===this.Login.value.loginpassword; 
});
if (adminl) {
Swal.fire('success', 'Admin is logged in successfully', 'succes`your text`s');
this.Login.reset();`your text`
this.route.navigate(\['/superadmin'\]);
} else {           
// user login logic
this.userLogin(id);         
}       
}});   
}  
userLogin(id: any) {
this.sign.getlogin(id).subscribe((res: any) =\> {
{
const user = res.find((b: any) =\> {
return b.loginemail === this.Login.value.loginemail && b.loginpassword === this.Login.value.loginpassword;
});
if (user){
Swal.fire({
icon:'success',
title:'SuccessFully',``` your text``your text ```
text:'Login Successfully',
});
this.route.navigate(\['/generalusers'\]);
this.dialog.open(UseraccesdelogComponent, {
width:'800px',
height:'600px',
});
this.Login.reset(); 
}
}
});
}
getlogin(id:any){
return this.http.get(this.urls,id); 
}
getdatas(id:any){
return this.http.get(this.urls,id);
}

字符串
为什么它不导航到下一页登录后它总是显示che不是一个功能,在网络中它200 ok,但它不导航到下一页,并使用firebase数据库存储所有数据

oalqel3c

oalqel3c1#

错误消息che不是函数”表明变量che用作函数存在问题。根据您提供的代码,似乎che既用作数组又用作函数参数,这可能导致错误。

id: any;

loginsubmit(id: any) {
 console.log("button works");
 const che = [];

 this.admincreation.getdatas(id).subscribe((data: any) => {
 // Remove the redundant curly braces here
 const adminl = data.find((b: any) => {
  return b.loginemail === this.Login.value.loginemail && b.loginpassword 
 === this.Login.value.loginpassword;
  });

  if (adminl) {
  Swal.fire('success', 'Admin is logged in successfully', 'success'); // Fixed the Swal.fire line
  this.Login.reset();
  this.route.navigate(['/superadmin']);
} else {
  // user login logic
  this.userLogin(id);
}
});
}

userLogin(id: any) {
this.sign.getlogin(id).subscribe((res: any) => {
const user = res.find((b: any) => {
  return b.loginemail === this.Login.value.loginemail && b.loginpassword === this.Login.value.loginpassword;
});

if (user) {
  Swal.fire({
    icon: 'success',
    title: 'Successfully Logged In',
    text: 'Login Successfully',
  });
  this.route.navigate(['/generalusers']);
  this.dialog.open(UseraccesdelogComponent, {
    width: '800px',
    height: '600px',
  });
  this.Login.reset();
  }
  });
 }

 getlogin(id: any) {
  return this.http.get(this.urls, id);
 }

 getdatas(id: any) {
 return this.http.get(this.urls, id);
}

字符串
我已经删除了多余的花括号,修复了Swal.fire行,并调整了代码中的一些注解。确保代码的结构如上所示,并且在正确登录后应该导航到下一页。
@Priyasingh如果你有,请问。

相关问题