Skip to content

Commit

Permalink
Merge pull request #16 from macs1207/dev
Browse files Browse the repository at this point in the history
Dev can be release
  • Loading branch information
macs1207 authored Jun 5, 2020
2 parents 4bdc1be + b897d28 commit dd15362
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ video
audio
resource/*.zip

error.log
error.log
*.db
12 changes: 6 additions & 6 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ def make_video():

@app.route('/api/feedback', methods = ['POST'])
def feedback():
text = request.values.get('feedback')
if text is None:
feedback = request.values.get('feedback')
if feedback is None:
return make_response("need feedback", 400)
text = text.strip()
if len(text) == 0:
feedback = feedback.strip()
if len(feedback) == 0:
return make_response("feedback is empty", 400)
if len(text) > 500:
if len(feedback) > 500:
return make_response("feedback is too long", 400)
save_to_db(text)
save_to_db(feedback)
return make_response("successful", 200)

@app.context_processor
Expand Down
6 changes: 6 additions & 0 deletions templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,12 @@ <h3 class="col-xs-12 col-sm-12 col-md-12 col-lg-12 line-size">有甚麼想跟我
feedback: this.feedback,
}, { emulateJSON: true }).then(
function (response) {
Swal.fire(
'我們收到啦!',
'',
'success'
)
this.feedback = '';
this.waiting = false;
$("#feedback-btn").attr('disabled', false);
}, function (response) {
Expand Down

0 comments on commit dd15362

Please sign in to comment.