Fix /getprinters to use GET request type
This commit is contained in:
7
samy.js
7
samy.js
@@ -234,7 +234,7 @@ async function fetchSites() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const resp = await fetch("/getpw", {
|
const resp = await fetch("/getpw", {
|
||||||
method: "GET",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
body: JSON.stringify({ password: pwd }),
|
body: JSON.stringify({ password: pwd }),
|
||||||
});
|
});
|
||||||
@@ -265,7 +265,7 @@ async function fetchSites() {
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
let allPrinters = [];
|
let allPrinters = [];
|
||||||
|
|
||||||
// GET /getprinters with password from Devices tab
|
// GET /getprinters with password from Devices tab (sent via SAMYPW header)
|
||||||
async function fetchPrinters() {
|
async function fetchPrinters() {
|
||||||
const pwdInput = document.getElementById("PrinterPassword");
|
const pwdInput = document.getElementById("PrinterPassword");
|
||||||
const pwd = pwdInput?.value;
|
const pwd = pwdInput?.value;
|
||||||
@@ -291,8 +291,7 @@ async function fetchPrinters() {
|
|||||||
try {
|
try {
|
||||||
const resp = await fetch("/getprinters", {
|
const resp = await fetch("/getprinters", {
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { SAMYPW: pwd },
|
||||||
body: JSON.stringify({ password: pwd }),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!resp.ok) throw new Error("HTTP " + resp.status);
|
if (!resp.ok) throw new Error("HTTP " + resp.status);
|
||||||
|
|||||||
Reference in New Issue
Block a user