clean up code and logs (#1809)

abstract base64 functions and clean up console logs
This commit is contained in:
Matt Hill
2022-09-19 12:59:41 -06:00
committed by GitHub
parent f04b90d9c6
commit 1150f4c438
13 changed files with 27 additions and 32 deletions

View File

@@ -70,7 +70,6 @@ export class LogsComponent {
url: `/rpc/${guid}`,
openObserver: {
next: () => {
console.log('**** LOGS WEBSOCKET OPEN ****')
this.websocketFail = false
this.processJob()
},

View File

@@ -216,7 +216,7 @@ export class WifiPage {
}
} catch (e) {
attempts++
console.error(e)
console.warn(e)
}
}
}

View File

@@ -1,5 +1,6 @@
import { Inject, Injectable } from '@angular/core'
import {
decodeBase64,
HttpOptions,
HttpService,
isRpcError,
@@ -18,7 +19,6 @@ import { AuthService } from '../auth.service'
import { DOCUMENT } from '@angular/common'
import { DataModel } from '../patch-db/data-model'
import { PatchDB, Update } from 'patch-db-client'
import * as Base64 from 'base64-js'
@Injectable()
export class LiveApiService extends ApiService {
@@ -420,15 +420,13 @@ export class LiveApiService extends ApiService {
const encodedError = res.headers.get('x-patch-error')
if (encodedUpdates) {
const decoded = new TextDecoder().decode(
Base64.toByteArray(encodedUpdates),
)
const decoded = decodeBase64(encodedUpdates)
const updates: Update<DataModel>[] = JSON.parse(decoded)
this.patchStream$.next(updates)
}
if (encodedError) {
const error = new TextDecoder().decode(Base64.toByteArray(encodedError))
const error = decodeBase64(encodedError)
console.error(error)
}