place available_templates call in update_auth_data to guarantee that user object exists

This commit is contained in:
Nariman Jelveh 2024-07-22 11:07:57 -07:00
parent a0113788f9
commit a9801fc10d
2 changed files with 4 additions and 4 deletions

View File

@ -432,7 +432,7 @@ window.refresh_user_data = async (auth_token)=>{
}
}
window.update_auth_data = (auth_token, user)=>{
window.update_auth_data = async (auth_token, user)=>{
window.auth_token = auth_token;
localStorage.setItem('auth_token', auth_token);
@ -493,6 +493,9 @@ window.update_auth_data = (auth_token, user)=>{
$('.user-options-login-btn, .user-options-create-account-btn').hide();
$('.user-options-menu-btn').show();
}
// Search and store user templates
window.file_templates = await window.available_templates()
}
window.mutate_user_preferences = function(user_preferences_delta) {
@ -838,7 +841,6 @@ window.create_file = async(options)=>{
}
window.available_templates = async () => {
console.log(window.user.username)
const baseRoute = `/${window.user.username}`
const keywords = ["template", "templates", i18n('template')]
//make sure all its lowercase

View File

@ -108,8 +108,6 @@ const launch_services = async function (options) {
const svc_process = globalThis.services.get('process');
svc_process.get_init().chstatus(PROCESS_RUNNING);
}
// Search and store user templates
window.file_templates = await window.available_templates()
};
// This code snippet addresses the issue flagged by Lighthouse regarding the use of