Skip to content

Commit a9801fc

Browse files
committed
place available_templates call in update_auth_data to guarantee that user object exists
1 parent a011378 commit a9801fc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/gui/src/helpers.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ window.refresh_user_data = async (auth_token)=>{
432432
}
433433
}
434434

435-
window.update_auth_data = (auth_token, user)=>{
435+
window.update_auth_data = async (auth_token, user)=>{
436436
window.auth_token = auth_token;
437437
localStorage.setItem('auth_token', auth_token);
438438

@@ -493,6 +493,9 @@ window.update_auth_data = (auth_token, user)=>{
493493
$('.user-options-login-btn, .user-options-create-account-btn').hide();
494494
$('.user-options-menu-btn').show();
495495
}
496+
497+
// Search and store user templates
498+
window.file_templates = await window.available_templates()
496499
}
497500

498501
window.mutate_user_preferences = function(user_preferences_delta) {
@@ -838,7 +841,6 @@ window.create_file = async(options)=>{
838841
}
839842

840843
window.available_templates = async () => {
841-
console.log(window.user.username)
842844
const baseRoute = `/${window.user.username}`
843845
const keywords = ["template", "templates", i18n('template')]
844846
//make sure all its lowercase

src/gui/src/initgui.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ const launch_services = async function (options) {
108108
const svc_process = globalThis.services.get('process');
109109
svc_process.get_init().chstatus(PROCESS_RUNNING);
110110
}
111-
// Search and store user templates
112-
window.file_templates = await window.available_templates()
113111
};
114112

115113
// This code snippet addresses the issue flagged by Lighthouse regarding the use of

0 commit comments

Comments
 (0)