Handle back button when the user navigates to one of our own history events
parent
cc3876ff4a
commit
30a62e6378
|
@ -1,5 +1,6 @@
|
|||
async function render(path){
|
||||
async function render(path, s){
|
||||
var context = await getContext();
|
||||
if(!s)
|
||||
history.pushState({}, context.sitename, location.protocol+'//'+location.host+path);
|
||||
switch(path){
|
||||
//nothing but context
|
||||
|
@ -115,6 +116,10 @@ async function render(path){
|
|||
}
|
||||
}
|
||||
|
||||
window.addEventListener('popstate', (event) => {
|
||||
render(document.location.pathname, true);
|
||||
});
|
||||
|
||||
async function getContext(){
|
||||
var info = JSON.parse(await makeRequest('GET', '/api/instance/info'));
|
||||
info.sitename = info.name;
|
||||
|
|
Reference in New Issue