Fixed API key reset after reconnect
This commit is contained in:
parent
085ab77c57
commit
6a11f4a4d8
1 changed files with 3 additions and 2 deletions
|
|
@ -14,12 +14,13 @@ $(function() {
|
|||
OctoPrint.options.apikey = UI_API_KEY;
|
||||
|
||||
OctoPrint.socket.onMessage("connected", function(data) {
|
||||
OctoPrint.options.apikey = data.apikey;
|
||||
var payload = data.data;
|
||||
OctoPrint.options.apikey = payload.apikey;
|
||||
|
||||
// update the API key directly in jquery's ajax options too,
|
||||
// to ensure the fileupload plugin and any plugins still using
|
||||
// $.ajax directly still work fine too
|
||||
UI_API_KEY = data["apikey"];
|
||||
UI_API_KEY = payload["apikey"];
|
||||
$.ajaxSetup({
|
||||
headers: {"X-Api-Key": UI_API_KEY}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue