Commit 259e32ba authored by Cranky Kernel's avatar Cranky Kernel

webapp: use queryParams for symbol and trade view

Instead of route params, so we can get merge behaviour.

Fixes the issue when a symbol is clicked on, the visible
trades defaults to all.

Reported by a user on Telegram.
parent 632a0162
<td class="nowrap">
<a [routerLink]="['/trade', {symbol: trade.Symbol}]">{{trade.Symbol}}</a>
<a [routerLink]="['/trade']" [queryParams]="{symbol: trade.Symbol}" queryParamsHandling="merge">{{trade.Symbol}}</a>
<br/>
{{trade.Status}}
<br/>
......@@ -137,7 +137,7 @@
<tr>
<td></td>
<td>
<b style="color: grey">-- Limit Sell--</b>
<b style="color: grey">-- Limit Sell--</b>
</td>
</tr>
......
......@@ -13,13 +13,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import {
AfterViewInit,
Component,
Input,
OnDestroy,
OnInit
} from "@angular/core";
import {AfterViewInit, Component, Input, OnDestroy, OnInit} from "@angular/core";
import {MakerService, TradeStatus} from "../maker.service";
import {Logger, LoggerService} from "../logger.service";
import {ToastrService} from "../toastr.service";
......
......@@ -113,13 +113,10 @@ export class TradeTableComponent implements OnInit, OnChanges {
}
switchTradeView(what) {
let params = Object.assign({}, this.route.snapshot.params);
if (what === null) {
delete (params["viewTrades"]);
} else {
params.viewTrades = what;
}
this.router.navigate([".", params], {
let params = Object.assign({}, this.route.snapshot.queryParams);
params.viewTrades = what;
this.router.navigate(["."], {
queryParams: params,
queryParamsHandling: "merge",
});
}
......
......@@ -219,7 +219,7 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit {
}
this.binance.isReady$.subscribe(() => {
this.route.params.subscribe((params) => {
let s = this.route.queryParams.subscribe((params) => {
const newSymbol = params.symbol;
if (newSymbol && newSymbol != this.orderFormSettings.symbol) {
this.changeSymbol(newSymbol);
......@@ -236,7 +236,8 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit {
this.viewTrades = "all";
break;
}
})
});
this.subs.push(s);
});
let s = this.maker.binanceAccountInfo$.subscribe((accountInfo) => {
......@@ -337,7 +338,12 @@ export class TradeComponent implements OnInit, OnDestroy, AfterViewInit {
symbol = this.orderFormSettings.symbol;
}
this.router.navigate(["/trade", {symbol: symbol}])
this.router.navigate(["/trade"], {
queryParams: {
symbol: symbol,
},
queryParamsHandling: "merge",
});
if (!symbol) {
this.saveState();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment