From 6eacb08e587cdaf2039a79e7f79c1a31e18fe752 Mon Sep 17 00:00:00 2001 From: Lucas Vas Date: Wed, 3 Sep 2025 11:34:47 -0400 Subject: [PATCH] chore: add one additional comment --- src/pages/home_page.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pages/home_page.rs b/src/pages/home_page.rs index 29e3222..1e20bef 100644 --- a/src/pages/home_page.rs +++ b/src/pages/home_page.rs @@ -18,11 +18,14 @@ use traits::{AsReactive, ReactiveCapture}; #[server(GetSubmission, endpoint = "/get-submission")] pub async fn get_submission(id: String) -> Result { + let config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await; let dbclient = Client::new(&config); console_log(format!("Getting values from API using username {}", id).as_str()); + // Gets the item from the database. It only returns an error if the database + // experiences an error - not if the item is not found. match dbclient .get_item() .table_name("student-applications") @@ -52,7 +55,6 @@ pub async fn get_submission(id: String) -> Result { pub async fn create_sample_submission( student_info: StudentInfo, ) -> Result<(), ServerFnError> { - use aws_sdk_dynamodb::Client; let config = aws_config::load_defaults(aws_config::BehaviorVersion::latest()).await; let dbclient = Client::new(&config); @@ -69,10 +71,12 @@ pub async fn create_sample_submission( .send().await { Ok(_) => { + // The student's information was successfully created console_log(format!("Set up student information: {:?}", student_info).as_str()); Ok(()) }, Err(err) => { + // There was an error while creating the student's information let msg = err.message().unwrap_or("An unknown error occurred."); console_log(format!("Error creating sample submission: {}", msg).as_str()); Err(ServerFnError::new(msg))