2017-09-12 2 views
0

devextreme scheduler를 사용하여 약속 스케줄러의 앱을 만들려고합니다. 나는 약간의 버그가있다. 난 그냥 내가 내 콘솔에서이 오류를 만들 임명 내가 약속 드래그를 만들 때, 이유를 알고 드롭 싶습니다 :devextreme scheduler 's plug-in 4에 새로 고침 오류가 발생했습니다.

PUT http://localhost/v0/croissant/undefined 404 (Not Found) 
appointment.service.ts:19 An error occurred Response {_body: "", status: 404, ok: false, statusText: "Not Found", headers: Headers…} 
webpackJsonp.../../../../../src/app/services/appointment.service.ts.AppointmentService.handleError @ appointment.service.ts:19 
ZoneDelegate.invoke @ zone.js:203 
onInvoke @ core.es5.js:3890 
ZoneDelegate.invoke @ zone.js:202 
Zone.run @ zone.js:96 
(anonymous) @ zone.js:462 
ZoneDelegate.invokeTask @ zone.js:236 
onInvokeTask @ core.es5.js:3881 
ZoneDelegate.invokeTask @ zone.js:235 
Zone.runTask @ zone.js:136 
drainMicroTaskQueue @ zone.js:368 
ZoneTask.invoke @ zone.js:308 
core.es5.js:1020 ERROR Error: Uncaught (in promise): Response with status: 404 Not Found for URL: http://localhost/v0/croissant/undefined 

하지만 난 다음 페이지를 새로 고침 할 때 내가 약속을 이동, 모든 것을 ... 여기

내 업데이트 약속 방법은 내 appointment.Service.ts에 괜찮 작품은 여기
updateAppointment(id: string, userId :string, timestamp :string, reason: string): Promise<Appointment>{ 

    let bodySearchParam = new URLSearchParams(); 
    bodySearchParam.append('userId', userId); 
    bodySearchParam.append('timestamp', this.datetotimestamp(timestamp).toString()); 
    bodySearchParam.append('reason', reason); 
    let body = bodySearchParam.toString(); 


    var AppointmentUrlUpdate = this.AppointmentUrlWrite + "/" + id; 

    return this.http.put(AppointmentUrlUpdate, body) 
        .toPromise() 
        .then(response => 
         console.log("event updated") 
        ) 
        .catch(this.handleError); 

    } 

내 달력 구성 요소에 내 이벤트 핸들러입니다

여기

와 내가 내 calendar.component.html 내 이벤트 핸들러를 호출 할 경우 당신의 도움을

<dx-scheduler 
    (onAppointmentUpdated)= "updateAppointment($event)" 
> 

</dx-scheduler> 

감사의가!

답변

0

문제는 내 API가 필요하고 약속을 업데이트하는 ID입니다. 그러나 이드는 현재 저장되지 않습니다. 해상도의 방법은 다음과 같습니다

getCreatedId(){ 
    return this.createdId; 
    } 

과 updateAppointment 방법에

이 수행 :

createAppointment(userId :string, timestamp :string, reason: string): Promise<Appointment> { 

    let bodySearchParam = new URLSearchParams(); 
    bodySearchParam.append('userId', userId); 
    bodySearchParam.append('timestamp', this.datetotimestamp(timestamp).toString()); 
    bodySearchParam.append('reason', reason); 
    let body = bodySearchParam.toString(); 

    console.log(body) 
    return this.http.post(this.AppointmentUrlWrite,body) 
        .toPromise() 
        .then(response => 
        this.createdId = response.json().id // Get the appointment's ID 
       ) 
        .catch(this.handleError); 
    } 

가 createdID를 반환하는 기능을

조건이 이미 약속에 대한 역할을
if(e.appointmentData.id == null){e.appointmentData.id = this.appointmentService.getCreatedId();} 

아이디를 가짐 (모든 약속은 페이지를 새로 고친 후 ID가 있음)

다른 사람에게 도움이되기를 바랍니다.

관련 문제