Make get_session() readonly and throw an exception if session cannot be found rather...
[ndcode_site.git] / api / globals / set.json.jst
index 64d385d..70c684a 100644 (file)
@@ -1,5 +1,4 @@
 let jst_server = (await import('@ndcode/jst_server')).default
-let XDate = require('xdate')
 
 return async env => {
   let post_request = await _require('/_lib/post_request.jst')
@@ -26,16 +25,10 @@ return async env => {
 
       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',