Merge pull request #812 from mempool/simon/liquid-block-hash-search-fix

Handle search for Liquid block hashes in search bar.
This commit is contained in:
wiz 2021-09-26 05:15:06 +09:00 committed by GitHub
commit 1f8ec2bd8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,7 +107,12 @@ export class SearchFormComponent implements OnInit {
this.electrsApiService.getAsset$(searchText)
.subscribe(
() => { this.navigate('/asset/', searchText); },
() => { this.navigate('/tx/', searchText); }
() => {
this.electrsApiService.getBlock$(searchText)
.subscribe(
(block) => { this.navigate('/block/', searchText, { state: { data: { block } } }); },
() => { this.navigate('/tx/', searchText); });
}
);
} else {
this.navigate('/tx/', searchText);
@ -118,8 +123,8 @@ export class SearchFormComponent implements OnInit {
}
}
navigate(url: string, searchText: string) {
this.router.navigate([(this.network && this.stateService.env.BASE_MODULE === 'mempool' ? '/' + this.network : '') + url, searchText]);
navigate(url: string, searchText: string, extras?: any) {
this.router.navigate([(this.network && this.stateService.env.BASE_MODULE === 'mempool' ? '/' + this.network : '') + url, searchText], extras);
this.searchTriggered.emit();
this.searchForm.setValue({
searchText: '',