From 7204a0e77be0576fd349177efb1241161555b4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ba=C5=99tip=C3=A1n?= Date: Thu, 6 Jun 2024 15:05:51 +0200 Subject: [PATCH] WebView and Connect integration: implemented logout flow via /slicer/logout --- src/slic3r/GUI/WebViewDialog.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/slic3r/GUI/WebViewDialog.cpp b/src/slic3r/GUI/WebViewDialog.cpp index 6b2b0e47db..bac2bcdf7e 100644 --- a/src/slic3r/GUI/WebViewDialog.cpp +++ b/src/slic3r/GUI/WebViewDialog.cpp @@ -636,6 +636,19 @@ void ConnectWebViewPanel::logout() { wxString script = L"window._prusaConnect_v1.logout()"; run_script(script); + + Plater* plater = wxGetApp().plater(); + m_browser->RunScript(wxString::Format( + R"( + console.log('Preparing login'); + window.fetch('/slicer/logout', {method: 'POST', headers: {Authorization: 'Bearer %s'}}) + .then((resp) => { + console.log('Login resp', resp); + resp.text().then((json) => console.log('Login resp body', json)); + }); + )", + plater->get_user_account()->get_access_token() + )); } void ConnectWebViewPanel::sys_color_changed()