Skip to content

Commit

Permalink
might help
Browse files Browse the repository at this point in the history
  • Loading branch information
kreynoldsf5 committed May 2, 2024
1 parent 55fa607 commit ec1d977
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions labapp/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ def return_err(err):
}
return render_template("error.html", err_img=img[err.code])

@app.after_request
def cache_control(response):
if request.path.startswith("/static/") and request.path.endswith(".png"):
response.headers['Cache-Control'] = 'public, max-age=3600'
return response

@app.route('/')
def index():
"""index page"""
Expand Down
2 changes: 1 addition & 1 deletion labapp/app/static/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function makeHttpRequest(buttonId, requestUrl, resultDivId) {
resultDiv.innerHTML = `<div class="alert alert-success"><b>Request Succeeded:</b><br><pre><code class="hljs">${prettyJson}</code></pre></div>`;
} else {
const errJson = JSON.stringify(response.data.error, null, 4);
resultDiv.innerHTML = `<div class="alert alert-danger"><b>Request Failed:</b><br><pre><code>${errJson}</code></pre></div>`;
resultDiv.innerHTML = `<div class="alert alert-danger"><b>Request Failed:</b><br><pre><code class="hljs">${errJson}</code></pre></div>`;
}
} catch (error) {
resultDiv.innerHTML = `<div class="alert alert-danger">Error: ${error.message}</div>`;
Expand Down

0 comments on commit ec1d977

Please sign in to comment.