javascript – One page with history – Mustache Template Engine

I use mustache for my unique page application I charge small html in the big:

let $ content = $ ('# content');
leave login = (user) => {
$ .ajax ({
url: & # 39; ./ templates / login-view.html & # 39;
success: (tmpl) => {
let $ html = Mustache.render (tmpl, user);
$ content.html ($ html);
}
})
}

"#content" is the container in which I add the small htmls, but since, how can I grow this in the window.history api:

window.history.pushState (null, null, url);

Preferably, I want to push a method in history, because when connecting, I put some things in local storage, so I want the back button to run:

leave disconnection = (e) => {
preventDefault (e);
localStorage.clear ();
getHomeView ();

}