Add content-type to sent requests

This commit is contained in:
Yukino Song
2025-05-28 14:09:12 +08:00
parent b2ec048333
commit f3d2078b11
7 changed files with 53 additions and 20 deletions

View File

@@ -599,7 +599,10 @@
fetch("./api/apps/reorder", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({order: reorderedUUIDs})
})
.then(r => r.json())
@@ -636,7 +639,7 @@
this.actionDisabled = true;
fetch("./api/apps/launch?uuid=" + app.uuid, {
credentials: 'include',
method: "POST",
method: 'POST',
})
.then(r => r.json())
.then(r => {
@@ -655,7 +658,7 @@
this.actionDisabled = true;
fetch("./api/apps/close", {
credentials: 'include',
method: "POST"
method: 'POST',
})
.then((r) => r.json())
.then((r) => {
@@ -681,7 +684,7 @@
this.actionDisabled = true;
fetch("./api/apps/delete?uuid=" + app.uuid, {
credentials: 'include',
method: "POST"
method: 'POST'
}).then((r) => r.json())
.then((r) => {
if (!r.status) {
@@ -789,7 +792,10 @@
this.coverFinderBusy = true;
fetch("./api/covers/upload", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({
key: cover.key,
url: cover.saveUrl,
@@ -814,7 +820,10 @@
delete this.editForm.dragover;
fetch("./api/apps", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify(this.editForm),
}).then((r) => r.json())
.then((r) => {

View File

@@ -437,7 +437,10 @@
return fetch("./api/config", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify(config),
}).then((r) => {
if (r.status === 200) {
@@ -460,7 +463,7 @@
this.saved = this.restarted = false;
}, 5000);
fetch("./api/restart", {
method: "POST"
method: 'POST'
})
.then((resp) => {
if (resp.status !== 200) {

View File

@@ -89,7 +89,10 @@
localStorage.removeItem('login')
}
fetch("./api/login", {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify(this.passwordData),
}).then((res) => {
this.loading = false;

View File

@@ -96,7 +96,10 @@
this.error = null;
fetch("./api/password", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify(this.passwordData),
}).then((r) => {
if (r.status === 200) {

View File

@@ -393,7 +393,10 @@
let b = JSON.stringify({pin: pin, name: name});
fetch("./api/pin", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: b
})
.then((response) => response.json())
@@ -537,7 +540,10 @@
}
fetch("./api/clients/update", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify(editedClient)
})
.catch(err => {
@@ -583,7 +589,10 @@
disconnectClient(uuid) {
fetch("./api/clients/disconnect", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({ uuid })
}).finally(() => {
setTimeout(() => {
@@ -595,7 +604,7 @@
this.unpairAllPressed = true;
fetch("./api/clients/unpair-all", {
credentials: 'include',
method: "POST"
method: 'POST'
})
.then((r) => r.json())
.then((r) => {
@@ -610,7 +619,10 @@
unpairSingle(uuid) {
fetch("./api/clients/unpair", {
credentials: 'include',
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify({ uuid })
}).then(() => {
this.showApplyMessage = true;

View File

@@ -205,7 +205,7 @@
this.closeAppPressed = true;
fetch("./api/apps/close", {
credentials: 'include',
method: "POST"
method: 'POST'
})
.then((r) => r.json())
.then((r) => {
@@ -226,7 +226,7 @@
}, 5000);
fetch("./api/restart", {
credentials: 'include',
method: "POST",
method: 'POST',
})
.then((resp) => {
if (resp.status !== 200) {
@@ -250,7 +250,7 @@
this.serverQuitting = true;
fetch("./api/quit", {
credentials: 'include',
method: "POST",
method: 'POST',
})
.then(() => {
this.serverQuitting = false;
@@ -267,7 +267,7 @@
this.ddResetPressed = true;
fetch("/api/reset-display-device-persistence", {
credentials: 'include',
method: "POST"
method: 'POST'
})
.then((r) => r.json())
.then((r) => {

View File

@@ -81,7 +81,10 @@
this.error = null;
this.loading = true;
fetch("./api/password", {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify(this.passwordData),
}).then((r) => {
this.loading = false;