Merge pull request #5230 from mempool/simon/docs-root-network-support
Docs root network support
This commit is contained in:
		
						commit
						f02d8e0626
					
				@ -72,7 +72,7 @@ export class ApiDocsComponent implements OnInit, AfterViewInit {
 | 
			
		||||
    this.auditEnabled = this.env.AUDIT;
 | 
			
		||||
    this.network$ = merge(of(''), this.stateService.networkChanged$).pipe(
 | 
			
		||||
      tap((network: string) => {
 | 
			
		||||
        if (this.env.BASE_MODULE === 'mempool' && network !== '') {
 | 
			
		||||
        if (this.env.BASE_MODULE === 'mempool' && network !== '' && this.env.ROOT_NETWORK === '') {
 | 
			
		||||
          this.baseNetworkUrl = `/${network}`;
 | 
			
		||||
        } else if (this.env.BASE_MODULE === 'liquid') {
 | 
			
		||||
          if (!['', 'liquid'].includes(network)) {
 | 
			
		||||
@ -195,6 +195,10 @@ export class ApiDocsComponent implements OnInit, AfterViewInit {
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (network === this.env.ROOT_NETWORK) {
 | 
			
		||||
      curlNetwork = '';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let text = code.codeTemplate.curl;
 | 
			
		||||
    for (let index = 0; index < curlResponse.length; index++) {
 | 
			
		||||
      const curlText = curlResponse[index];
 | 
			
		||||
 | 
			
		||||
@ -284,7 +284,7 @@ yarn add @mempool/liquid.js`;
 | 
			
		||||
    const headersString = code.headers ? ` -H "${code.headers}"` : ``;
 | 
			
		||||
    
 | 
			
		||||
    if (this.env.BASE_MODULE === 'mempool') {
 | 
			
		||||
      if (this.network === 'main' || this.network === '') {
 | 
			
		||||
      if (this.network === 'main' || this.network === '' || this.network === this.env.ROOT_NETWORK) {
 | 
			
		||||
        if (this.method === 'POST') {
 | 
			
		||||
          return `curl${headersString} -X POST -sSLd "${text}"`;
 | 
			
		||||
        }
 | 
			
		||||
@ -296,7 +296,7 @@ yarn add @mempool/liquid.js`;
 | 
			
		||||
      return `curl${headersString} -sSL "${this.hostname}/${this.network}${text}"`;
 | 
			
		||||
    } else if (this.env.BASE_MODULE === 'liquid') {
 | 
			
		||||
      if (this.method === 'POST') {
 | 
			
		||||
        if (this.network !== 'liquid') {
 | 
			
		||||
        if (this.network !== 'liquid' || this.network === this.env.ROOT_NETWORK) {
 | 
			
		||||
          text = text.replace('/api', `/${this.network}/api`);
 | 
			
		||||
        }
 | 
			
		||||
        return `curl${headersString} -X POST -sSLd "${text}"`;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user