Make get_session() readonly and throw an exception if session cannot be found rather...
[ndcode_site.git] / api / nodemailers / get.json.jst
index 8030196..656a4d1 100644 (file)
@@ -1,5 +1,4 @@
 let jst_server = (await import('@ndcode/jst_server')).default
-let XDate = require('xdate')
 
 return async env => {
   let get_account = await _require('/_lib/get_account.jst')
@@ -13,16 +12,10 @@ return async env => {
     async () => {
       let transaction = await env.site.database.Transaction()
       try {
-        let root = await transaction.get({})
+        let root = await transaction.get()
         let session = await get_session(env, root)
 
         let account = await get_account(root, session)
-        if (account === undefined)
-          throw new jst_server.Problem(
-            'Unauthorized',
-            'Please sign in first.',
-            401
-          )
         if (!await account.get_json('administrator'))
           throw new jst_server.Problem(
             'Unauthorized',