Fix authenticated requests on Native

This commit is contained in:
Reckless_Satoshi 2023-03-04 02:14:45 -08:00
parent 2e71ffb3de
commit cee6ffbf45
No known key found for this signature in database
GPG Key ID: 9C4585B561315571

View File

@ -10,20 +10,16 @@ class ApiNativeClient implements ApiClient {
'Content-Type': 'application/json',
};
const robotToken = systemClient.getItem('robot_token');
if (robotToken) {
const sessionid = systemClient.getCookie('sessionid');
const csrftoken = systemClient.getCookie('csrftoken');
const pubKey = systemClient.getItem('pub_key');
headers = {
...headers,
...{
'X-CSRFToken': csrftoken,
Cookie: `sessionid=${sessionid};robot_token=${robotToken};csrftoken=${csrftoken};pub_key=${pubKey}`,
Cookie: `sessionid=${sessionid};token=${csrftoken}`,
},
};
}
return headers;
};