Fix: other jsonrpc widgets broken in 0.9.8

This commit is contained in:
shamoon 2024-09-10 07:09:51 -07:00
parent 52a4f1a423
commit 6324934faa

View File

@ -14,11 +14,11 @@ export async function sendJsonRpcRequest(url, method, params, widget) {
accept: "application/json",
};
if (widget.username && widget.password) {
if (widget?.username && widget?.password) {
headers.Authorization = `Basic ${Buffer.from(`${widget.username}:${widget.password}`).toString("base64")}`;
}
if (widget.key) {
if (widget?.key) {
headers.Authorization = `Bearer ${widget.key}`;
}