无法使用user_id从 API 获取笔记(数据)



我想使用user_id从api获取笔记数据,但我无法击中api,我尝试记录日志,但无法从api获取数据。谁能帮我什么我在代码缺失控制台检查错误我在获取数据时遇到404错误。
状态:未找到消息:"Http失败响应:

refresh(user_id){
this.isLoadingResults = true;
this.api.getdatachoice(user_id).subscribe(data =>{
this.studentData = data['items'];
console.log('studentData', this.studentData);

this.isLoadingResults = false;
})
this.filterInput
.valueChanges
.debounceTime(200)
.subscribe(term => {
this.filterText = term;
});
}
getdatachoice(user_id : any){
try{
const requestUrl = `${this.baseUrl}/api/admin/adminDashboard/getchoice=`+user_id;
return this.httpClient.get(requestUrl);
}catch(error){
this.handleError("getdatachoice : "+JSON.stringify(error));
}
}
router.get('/adminDashboard/getchoice', function (req, res) {
var students = [];
var course_name;
console.log("----------------------------fetched-------------------------------------");
//  models.User.findById(req.user._id({
models.User.find({
where:{
userId : req.query.user_id,
id : req.body.user_id
}
}).models.Application.getUnsignedUser(req.body.user_id).then(data => {
require('async').eachSeries(data, function(student, callback){
var courieraddress;
if(student.isNewAddressSame == true || student.isNewAddressSame == "" || 
student.isNewAddressSame == null){
courieraddress = student.address;
}else{
courieraddress = student.newaddress
}
//   models.User_Transcript.getCollegeName(student.user_id).then(function(colleges){
// 
models.Institution_details.getAllInstitutionType(student.user_id).then(function(types){
models.Applicant_Educational_Details.getCourseName(student.user_id).then(function 
name(edu_details) {
if(edu_details.length > 0){
course_name = edu_details ? edu_details[0].Course_full_name : '';
//console.log("course_name---->"+course_name);
}else{
course_name = '';
}
students.push({
id : student.id,
name :student.name,
email : student.email,
user_id : student.user_id,
university_name: student.university,
transcript_name: student.tcname,
student.instruction_medium : '--' ,
application_date : moment(new 
Date(student.created_at)).format("DD/MM/YYYY"),
recepientsname :student.name,
courieraddress : courieraddress,
noOfCopies : student.numofcouriers,
couremail : student.couremail,
courmobile :  student.courmobile,
newemail : student.newemail,
studentsAction : (student.preferredoptionfortranscriptdownload) ? 
student.preferredoptionfortranscriptdownload : 'Email',
course_name : course_name,
notes : student.notes , 
education_lock : student.education_lock ? student.education_lock : 'true',
course_short_form :edu_details[0] ? edu_details[0].CourseName : '',
enrollmentYear : student.enrollmentYear,
enrollmentYearStandard : student.enrollmentYearStandard,
leavingYear : student.leavingYear,
leavingYearStandard : student.leavingYearStandard
});
callback();
});
// });
// });
}, function(){
res.json({
status: 200,
message: 'Student retrive successfully',
items : students,
total_count : students.length
});
});
});
});

看起来您正在向/api/admin/adminDashboard/getchoice=<id>发出请求,但您的路由器指向/adminDashboard/getchoice。你需要使它们相同。

最新更新