client/webserver/site/src/js/settings.js
// exportAccount exports and downloads the account info
exportAccount exports and downloads the account info
exportAccount exports and downloads the account info
async exportAccount () {
    const page = this.page
    const pw = page.exportAccountAppPass.value
    const host = page.exportAccountHost.textContent
    page.exportAccountAppPass.value = ''
    const req = {
      pw: pw,
      host: host
    }
    const loaded = app.loading(this.body)
    const res = await postJSON('/api/exportaccount', req)
    loaded()
    if (!app.checkResponse(res)) {
      page.exportAccountErr.textContent = res.msg
      Doc.show(page.exportAccountErr)
      return
    }
    const accountForExport = JSON.parse(JSON.stringify(res.account))
    const a = document.createElement('a')
    a.setAttribute('download', 'dcrAccount-' + host + '.json')
    a.setAttribute('href', 'data:text/json,' + JSON.stringify(accountForExport, null, 2))
    a.click()
    Doc.hide(page.forms)
  }
async exportAccount ( ) { const page = this . page const pw = page . exportAccountAppPass . value const host = page . exportAccountHost . textContent page . exportAccountAppPass . value = '' const req = { pw : pw , host : host } const loaded = app . loading ( this . body ) const res = await postJSON ( '/api/exportaccount' , req ) loaded ( ) if ( ! app . checkResponse ( res ) ) { page . exportAccountErr . textContent = res . msg Doc . show ( page . exportAccountErr ) return } const accountForExport = JSON . parse ( JSON . stringify ( res . account ) ) const a = document . createElement ( 'a' ) a . setAttribute ( 'download' , 'dcrAccount-' + host + '.json' ) a . setAttribute ( 'href' , 'data:text/json,' + JSON . stringify ( accountForExport , null , 2 ) ) a . click ( ) Doc . hide ( page . forms ) }
exportAccount exports and downloads the account info
exportAccount exports and downloads the account info