Major refactoring of get_session(), get_account(), get_nodemailer(), introduces ...
[ndcode_site.git] / my_account / index.html.jst
index fc7f0d5..403ba6f 100644 (file)
@@ -13,10 +13,12 @@ return async env => {
   let transaction = await env.site.database.Transaction()
   let signed_in_as, details, draft_details
   try {
-    let session = await get_session(env, transaction)
+    let root = await transaction.get({})
+
+    let session = await get_session(env, root)
     signed_in_as = await session.get_json('signed_in_as', null)
 
-    let account = await get_account(env, transaction, session)
+    let account = await get_account(root, session)
     if (account !== undefined) {
       details = {
         given_names: await account.get_json('given_names'),
@@ -35,11 +37,9 @@ return async env => {
           } :
           null
     }
-    await transaction.commit()
   }
-  catch (error) {
+  finally {
     transaction.rollback()
-    throw error
   }
   console.log(
     'details',
@@ -253,7 +253,7 @@ return async env => {
                 step_1_dirty = true
                 document.getElementById('step-1-revert').disabled = false
                 document.getElementById('step-1-save').disabled = false
-    
+
                 if (!draft_timeout_running) {
                   draft_timeout_running = true
                   setTimeout(draft_timeout_handler, 5000)
@@ -279,7 +279,7 @@ return async env => {
                   $('#step-1-cross').hide()
                   $('#step-1-spinner').show()
 
-                  let details      
+                  let details
                   try {
                     details = await api_account_change_details_get()
                   }
@@ -296,7 +296,7 @@ return async env => {
                           400
                         )
                     console.log(problem.detail)
-      
+
                     $('#step-1-tick').hide()
                     $('#step-1-cross').show()
                     $('#step-1-spinner').hide()
@@ -336,7 +336,7 @@ return async env => {
                   $('#step-1-tick').hide()
                   $('#step-1-cross').hide()
                   $('#step-1-spinner').show()
-      
+
                   try {
                     await api_account_change_details_set(
                       {
@@ -359,7 +359,7 @@ return async env => {
                           400
                         )
                     console.log(problem.detail)
-      
+
                     $('#step-1-tick').hide()
                     $('#step-1-cross').show()
                     $('#step-1-spinner').hide()
@@ -421,7 +421,7 @@ return async env => {
                   $('#step-2-tick').hide()
                   $('#step-2-cross').hide()
                   $('#step-2-spinner').show()
-      
+
                   try {
                     await api_account_change_password(
                       // old_password
@@ -443,7 +443,7 @@ return async env => {
                           400
                         )
                     console.log(problem.detail)
-      
+
                     $('#step-2-tick').hide()
                     $('#step-2-cross').show()
                     $('#step-2-spinner').hide()