Browse Source

chore: layout comments added

Timothy J. Baek 1 năm trước cách đây
mục cha
commit
f30d16a3fd
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      src/routes/+layout.svelte

+ 4 - 0
src/routes/+layout.svelte

@@ -18,6 +18,7 @@
 		const backendConfig = await getBackendConfig();
 		const backendConfig = await getBackendConfig();
 
 
 		if (backendConfig) {
 		if (backendConfig) {
+			// Save Backend Status to Store
 			await config.set(backendConfig);
 			await config.set(backendConfig);
 			console.log(backendConfig);
 			console.log(backendConfig);
 
 
@@ -30,8 +31,10 @@
 					});
 					});
 
 
 					if (sessionUser) {
 					if (sessionUser) {
+						// Save Session User to Store
 						await user.set(sessionUser);
 						await user.set(sessionUser);
 					} else {
 					} else {
+						// Redirect Invalid Session User to /auth Page
 						localStorage.removeItem('token');
 						localStorage.removeItem('token');
 						await goto('/auth');
 						await goto('/auth');
 					}
 					}
@@ -40,6 +43,7 @@
 				}
 				}
 			}
 			}
 		} else {
 		} else {
+			// Redirect to /error when Backend Not Detected
 			await goto(`/error`);
 			await goto(`/error`);
 		}
 		}