angular - 使用电子邮件从获取请求中获取数据
问题描述
我正在尝试通过电子邮件获取用户详细信息,为此我使用了以下方法,但我收到 500 内部服务器错误
getUser = (email) => {
console.log("reached");
const PATH = `${this.BASE_URL}/getUser`;
return this.http.get(PATH, email).pipe(
map((res: any) => res),
catchError((error: any) =>
observableThrowError(error.error || "Server error")
)
);
};
我在 getUser 路线上的获取请求
public static async getUser(req, res, next) {
try {
const email = req.body.email;
console.log("email", email);
const user = await User.findOne({ email: email });
res.json({
token: jwt.encode(getJwtPayload(user), UserRoutes.JWT_SECRET),
user,
});
} catch (error) {
next(error);
}
}
解决方案
推荐阅读
- asp.net - .ASPX POST 请求 - 侵犯隐私:BREACH
- c# - 通过vector3列表平滑处理
- pdf - GZip 压缩 - 在 Response.OutputStream 中发送 PDF 流
- ios - UINavigationBar 在视图控制器的视图上方具有更高的高度
- arrays - 在 Postgres 中将列从 Integer[] (ARRAY) 更改为 Integer
- java - 以编程方式添加到自定义视图持有者的自定义视图实例的位置和大小错误
- angular - Angular 5 & .NET Core 2.0 - 路由器导航冻结网站
- r - 为什么 r 不排除带有过滤器的 NA
- php - PHP ARGON2I 密码哈希函数不起作用
- laravel - 多认证使用一页登录 laravel