fix(lesson): no-store cache header pada response lesson JSON
Mencegah browser/SW/proxy menyajikan lesson (termasuk quiz_data) dari cache stale, terutama saat file lesson diubah.
This commit is contained in:
parent
da6d7e25d3
commit
a157a31b78
|
|
@ -228,7 +228,11 @@ def api_lesson(filename):
|
||||||
parsed_data['slides'] = []
|
parsed_data['slides'] = []
|
||||||
# Keep lesson_html, lesson_info, etc. for reading
|
# Keep lesson_html, lesson_info, etc. for reading
|
||||||
|
|
||||||
return jsonify({
|
|
||||||
|
# Anti-cache: tiap request lesson selalu fresh dari disk (bukan cache
|
||||||
|
# browser/SW/proxy). Ini mencegah soal kuis "stale" saat file lesson diubah
|
||||||
|
# — terutama setelah navigasi antar tipe soal (mcq ↔ flashcard).
|
||||||
|
resp = jsonify({
|
||||||
'lesson_content': lesson_html,
|
'lesson_content': lesson_html,
|
||||||
'exercise_content': exercise_html,
|
'exercise_content': exercise_html,
|
||||||
'expected_output': expected_output,
|
'expected_output': expected_output,
|
||||||
|
|
@ -267,6 +271,9 @@ def api_lesson(filename):
|
||||||
'language': programming_language,
|
'language': programming_language,
|
||||||
'language_display_name': language_display_name,
|
'language_display_name': language_display_name,
|
||||||
})
|
})
|
||||||
|
resp.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, max-age=0'
|
||||||
|
resp.headers['Pragma'] = 'no-cache'
|
||||||
|
return resp
|
||||||
|
|
||||||
|
|
||||||
@lessons_bp.route('/get-key-text/<filename>')
|
@lessons_bp.route('/get-key-text/<filename>')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue