Implement a command-line interface to the running webserver, and a way to get/set...
[ndcode_site.git] / _config / sign_out.mjs
1 #!/usr/bin/env node
2
3 import Problem from './Problem.mjs'
4 import Session from './Session.mjs'
5
6 let session = new Session('session.json')
7 await session.load()
8
9 try {
10   await session.api_call('/api/account/sign_out.json')
11 }
12 catch (error) {
13   let problem = Problem.from(error)
14   console.error('problem:')
15   console.error('  title:', problem.title)
16   console.error('  detail:', problem.detail)
17   console.error('  status:', problem.status)
18
19   await session.save()
20   process.exit(1)
21 }
22
23 await session.save()