소스 검색

Send 200 on updates, show errors

tags/v1.0
Matt Baer 8 년 전
부모
커밋
63473d8129
2개의 변경된 파일7개의 추가작업 그리고 5개의 파일을 삭제
  1. +1
    -1
      construction.go
  2. +6
    -4
      templates/editor.html

+ 1
- 1
construction.go 파일 보기

@@ -61,7 +61,7 @@ func renovateHouse(app *app, w http.ResponseWriter, r *http.Request) error {

resUser := newSessionInfo(houseID)

return impart.WriteSuccess(w, resUser, http.StatusCreated)
return impart.WriteSuccess(w, resUser, http.StatusOK)
}

func getHouseHTML(app *app, houseID string) (string, error) {


+ 6
- 4
templates/editor.html 파일 보기

@@ -85,16 +85,18 @@ $("#publish").on('click', function(e) {
data: {html: editor.getSession().getValue()},
success: function(data, status, xhr) {
publishing = false;
if (data.meta.code == 201) {
{{if .ID}}if (data.meta.code == 200) { {{else}}if (data.meta.code == 201) {
var houses = JSON.parse(H.get('neighborhood', '[]'));
houses.push({id: data.data.id, token: xhr.getResponseHeader('Authorization')});
H.set('neighborhood', JSON.stringify(houses));

H.set('neighborhood', JSON.stringify(houses));{{end}}
window.location = '/' + data.data.id + '.html';
} else {
alert(data.meta.error_msg);
}
},
failure: function(data, status, xhr) {
error: function(jqXHR, status, error) {
publishing = false;
alert(error);
}
});
});


불러오는 중...
취소
저장