mirror of
https://github.com/karl0ss/homepage.git
synced 2025-05-04 14:33:41 +01:00
QNAP widget make sure re-auth status = 200
This commit is contained in:
parent
d402be2b78
commit
a9d3873579
@ -64,6 +64,12 @@ async function apiCall(widget, endpoint, service) {
|
|||||||
key = await login(widget, service);
|
key = await login(widget, service);
|
||||||
apiUrl = new URL(formatApiCall(`${endpoint}&sid=${key}`, widget));
|
apiUrl = new URL(formatApiCall(`${endpoint}&sid=${key}`, widget));
|
||||||
[status, contentType, data, responseHeaders] = await httpProxy(apiUrl);
|
[status, contentType, data, responseHeaders] = await httpProxy(apiUrl);
|
||||||
|
|
||||||
|
if (status !== 200) {
|
||||||
|
logger.error("Error getting data from QNAP: %s status %d. Data: %s", apiUrl, status, data);
|
||||||
|
return { status, contentType, data: null, responseHeaders };
|
||||||
|
}
|
||||||
|
|
||||||
dataDecoded = JSON.parse(xml2json(data.toString(), { compact: true }).toString());
|
dataDecoded = JSON.parse(xml2json(data.toString(), { compact: true }).toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user