fix: post plain objects in WebView2 refresh script

This commit is contained in:
SuperDooper
2026-05-08 16:15:07 +02:00
parent 6aee17fad2
commit 22e9096f7c
+2 -2
View File
@@ -203,11 +203,11 @@ public class UsageViewModel : INotifyPropertyChanged
if(!id){ if(!id){
let pu=null; let pu=null;
try{pu=await(await fetch('/api/usage',h)).json();}catch(e3){} try{pu=await(await fetch('/api/usage',h)).json();}catch(e3){}
window.chrome.webview.postMessage(JSON.stringify({email:em,orgId:null,usage:(pu&&!pu.error?pu:null)})); window.chrome.webview.postMessage({email:em,orgId:null,usage:(pu&&!pu.error?pu:null)});
return; return;
} }
const u=await(await fetch('/api/organizations/'+id+'/usage',h)).json(); const u=await(await fetch('/api/organizations/'+id+'/usage',h)).json();
window.chrome.webview.postMessage(JSON.stringify({email:em,orgId:id,usage:u})); window.chrome.webview.postMessage({email:em,orgId:id,usage:u});
}catch(ex){window.chrome.webview.postMessage(null);}})();"; }catch(ex){window.chrome.webview.postMessage(null);}})();";
var resultJson = await Application.Current.Dispatcher.InvokeAsync(async () => var resultJson = await Application.Current.Dispatcher.InvokeAsync(async () =>