From 1c3346cd534143f4dd56a625b963a1a3acfa83d1 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Mon, 29 May 2017 16:27:53 +0200
Subject: less ad-hoc messaging, fix some lint warnings

---
 src/webex/pages/payback.tsx | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

(limited to 'src/webex/pages/payback.tsx')

diff --git a/src/webex/pages/payback.tsx b/src/webex/pages/payback.tsx
index 7bcc581d8..e10da7b05 100644
--- a/src/webex/pages/payback.tsx
+++ b/src/webex/pages/payback.tsx
@@ -21,25 +21,28 @@
  */
 
 
+/**
+ * Imports.
+ */
 import { amountToPretty, getTalerStampDate } from "../../helpers";
 import {
-  ExchangeRecord,
-  ExchangeForCurrencyRecord,
-  DenominationRecord,
   AuditorRecord,
-  CurrencyRecord,
-  ReserveRecord,
   CoinRecord,
-  PreCoinRecord,
+  CurrencyRecord,
   Denomination,
+  DenominationRecord,
+  ExchangeForCurrencyRecord,
+  ExchangeRecord,
+  PreCoinRecord,
+  ReserveRecord,
   WalletBalance,
 } from "../../types";
 
 import { ImplicitStateComponent, StateHolder } from "../components";
 import {
   getCurrencies,
-  updateCurrency,
   getPaybackReserves,
+  updateCurrency,
   withdrawPaybackReserve,
 } from "../wxApi";
 
@@ -47,10 +50,10 @@ import * as React from "react";
 import * as ReactDOM from "react-dom";
 
 class Payback extends ImplicitStateComponent<any> {
-  reserves: StateHolder<ReserveRecord[]|null> = this.makeState(null);
+  private reserves: StateHolder<ReserveRecord[]|null> = this.makeState(null);
   constructor() {
     super();
-    let port = chrome.runtime.connect();
+    const port = chrome.runtime.connect();
     port.onMessage.addListener((msg: any) => {
       if (msg.notify) {
         console.log("got notified");
@@ -61,25 +64,25 @@ class Payback extends ImplicitStateComponent<any> {
   }
 
   async update() {
-    let reserves = await getPaybackReserves();
+    const reserves = await getPaybackReserves();
     this.reserves(reserves);
   }
 
   withdrawPayback(pub: string) {
-    withdrawPaybackReserve(pub); 
+    withdrawPaybackReserve(pub);
   }
 
   render(): JSX.Element {
-    let reserves = this.reserves();
+    const reserves = this.reserves();
     if (!reserves) {
       return <span>loading ...</span>;
     }
-    if (reserves.length == 0) {
+    if (reserves.length === 0) {
       return <span>No reserves with payback available.</span>;
     }
     return (
       <div>
-        {reserves.map(r => (
+        {reserves.map((r) => (
           <div>
             <h2>Reserve for ${amountToPretty(r.current_amount!)}</h2>
             <ul>
@@ -93,7 +96,7 @@ class Payback extends ImplicitStateComponent<any> {
   }
 }
 
-export function main() {
+function main() {
   ReactDOM.render(<Payback />, document.getElementById("container")!);
 }
 
-- 
cgit v1.2.3

