refactor(notifications): rename test notification proxy function
Rename the `proxy_send_test_notification` function to `send_test_notification_proxy` for better naming consistency. The corresponding template is updated to use `url_for` for the fetch request, making the URL generation more robust and maintainable.
This commit is contained in:
parent
a9276f63dc
commit
0f1e97bba2
2
app.py
2
app.py
@ -121,7 +121,7 @@ def proxy_save_subscription():
|
|||||||
return jsonify({"error": str(e)}), 502
|
return jsonify({"error": str(e)}), 502
|
||||||
|
|
||||||
@app.route('/send-test-notification', methods=['POST'])
|
@app.route('/send-test-notification', methods=['POST'])
|
||||||
def proxy_send_test_notification():
|
def send_test_notification_proxy():
|
||||||
"""Proxies the request to send a test notification to the backend."""
|
"""Proxies the request to send a test notification to the backend."""
|
||||||
if not session.get("logged_in"):
|
if not session.get("logged_in"):
|
||||||
return jsonify({'error': 'Unauthorized'}), 401
|
return jsonify({'error': 'Unauthorized'}), 401
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
document.getElementById('version-link').addEventListener('click', function(event) {
|
document.getElementById('version-link').addEventListener('click', function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
fetch('/send-test-notification', {
|
fetch('{{ url_for("send_test_notification_proxy") }}', {
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}).then(response => response.json())
|
}).then(response => response.json())
|
||||||
.then(data => console.log(data.message))
|
.then(data => console.log(data.message))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user