05/24 Fix bugs
This commit is contained in:
@@ -357,7 +357,7 @@ async function runAnalysis() {
|
||||
if (model) fd.append('model', model);
|
||||
|
||||
try {
|
||||
var resp = await fetch('/ai-summary/analyze', { method: 'POST', body: fd });
|
||||
var resp = await fetch('/ai-summary/analyze', { method: 'POST', body: fd, headers: {'X-CSRFToken': getCsrfToken()} });
|
||||
var data = await resp.json();
|
||||
if (data.error) {
|
||||
document.getElementById('ai-output').innerHTML =
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<title>{% block title %}Website Checker{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
</head>
|
||||
|
||||
@@ -299,6 +299,7 @@ function renderDetail(data) {
|
||||
? '<button class="btn btn-secondary btn-sm" onclick="openEditModal(' + b.id + ')">✎ Edit</button>'
|
||||
+ '<form method="post" action="/bids/' + b.id + '/delete" style="display:inline"'
|
||||
+ ' onsubmit="return confirm(\'Delete \\\'' + esc(b.title) + '\\\'?\')">'
|
||||
+ '<input type="hidden" name="csrf_token" value="' + getCsrfToken() + '">'
|
||||
+ '<button class="btn btn-danger btn-sm" type="submit">✕ Delete</button></form>'
|
||||
: '';
|
||||
|
||||
@@ -352,7 +353,7 @@ function postUpdate(bidId) {
|
||||
var fd = new FormData();
|
||||
fd.append('content', content);
|
||||
|
||||
fetch('/bids/' + bidId + '/updates/json', { method: 'POST', body: fd, credentials: 'same-origin' })
|
||||
fetch('/bids/' + bidId + '/updates/json', { method: 'POST', body: fd, credentials: 'same-origin', headers: {'X-CSRFToken': getCsrfToken()} })
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(d) {
|
||||
if (d.error) { alert(d.error); return; }
|
||||
@@ -371,7 +372,7 @@ function postUpdate(bidId) {
|
||||
function deleteUpdate(updateId, bidId) {
|
||||
if (!confirm('Delete this update?')) return;
|
||||
var fd = new FormData();
|
||||
fetch('/bids/updates/' + updateId + '/delete/json', { method: 'POST', body: fd, credentials: 'same-origin' })
|
||||
fetch('/bids/updates/' + updateId + '/delete/json', { method: 'POST', body: fd, credentials: 'same-origin', headers: {'X-CSRFToken': getCsrfToken()} })
|
||||
.then(function(r) { return r.json(); })
|
||||
.then(function(d) {
|
||||
if (d.error) { alert(d.error); return; }
|
||||
|
||||
@@ -292,7 +292,7 @@ document.getElementById('btn-bulk-check').addEventListener('click', function() {
|
||||
Promise.all(selected.map(function(id) {
|
||||
return fetch('/dashboard/check/' + id, {
|
||||
method: 'POST', credentials: 'same-origin',
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
|
||||
headers: {'Content-Type': 'application/x-www-form-urlencoded', 'X-CSRFToken': getCsrfToken()},
|
||||
body: 'user_note='
|
||||
});
|
||||
})).then(function() { location.reload(); });
|
||||
|
||||
Reference in New Issue
Block a user