fix: update WebView2 refresh script to use postMessage
This commit is contained in:
@@ -201,13 +201,14 @@ public class UsageViewModel : INotifyPropertyChanged
|
|||||||
if(Array.isArray(ol)&&ol.length>0)id=ol[0]?.uuid||null;}catch(e2){}
|
if(Array.isArray(ol)&&ol.length>0)id=ol[0]?.uuid||null;}catch(e2){}
|
||||||
}
|
}
|
||||||
if(!id){
|
if(!id){
|
||||||
try{const pu=await(await fetch('/api/usage',h)).json();
|
let pu=null;
|
||||||
if(pu&&!pu.error)return{email:em,orgId:null,usage:pu};}catch(e3){}
|
try{pu=await(await fetch('/api/usage',h)).json();}catch(e3){}
|
||||||
return{email:em,orgId:null,usage:null};
|
window.chrome.webview.postMessage(JSON.stringify({email:em,orgId:null,usage:(pu&&!pu.error?pu:null)}));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const u=await(await fetch('/api/organizations/'+id+'/usage',h)).json();
|
const u=await(await fetch('/api/organizations/'+id+'/usage',h)).json();
|
||||||
return{email:em,orgId:id,usage:u};
|
window.chrome.webview.postMessage(JSON.stringify({email:em,orgId:id,usage:u}));
|
||||||
}catch(ex){return null;}})()";
|
}catch(ex){window.chrome.webview.postMessage(null);}})();";
|
||||||
|
|
||||||
var resultJson = await Application.Current.Dispatcher.InvokeAsync(async () =>
|
var resultJson = await Application.Current.Dispatcher.InvokeAsync(async () =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user