Commit f3d25785 authored by nanahira's avatar nanahira

support preview ad

parent 747302a9
Pipeline #17965 passed with stages
in 2 minutes and 14 seconds
...@@ -138,10 +138,12 @@ export class ApiService extends BaseService { ...@@ -138,10 +138,12 @@ export class ApiService extends BaseService {
* This method doesn't expect any request body. * This method doesn't expect any request body.
*/ */
adControllerGetAd$Response(params?: { adControllerGetAd$Response(params?: {
id?: number;
}): Observable<StrictHttpResponse<AdReturnMessageDto>> { }): Observable<StrictHttpResponse<AdReturnMessageDto>> {
const rb = new RequestBuilder(this.rootUrl, ApiService.AdControllerGetAdPath, 'get'); const rb = new RequestBuilder(this.rootUrl, ApiService.AdControllerGetAdPath, 'get');
if (params) { if (params) {
rb.query('id', params.id, {});
} }
return this.http.request(rb.build({ return this.http.request(rb.build({
...@@ -166,6 +168,7 @@ export class ApiService extends BaseService { ...@@ -166,6 +168,7 @@ export class ApiService extends BaseService {
* This method doesn't expect any request body. * This method doesn't expect any request body.
*/ */
adControllerGetAd(params?: { adControllerGetAd(params?: {
id?: number;
}): Observable<AdReturnMessageDto> { }): Observable<AdReturnMessageDto> {
return this.adControllerGetAd$Response(params).pipe( return this.adControllerGetAd$Response(params).pipe(
......
...@@ -5,6 +5,7 @@ import { ApiService } from './api/services/api.service'; ...@@ -5,6 +5,7 @@ import { ApiService } from './api/services/api.service';
import { lastValueFrom } from 'rxjs'; import { lastValueFrom } from 'rxjs';
import * as moment from 'moment'; import * as moment from 'moment';
import { Ad } from './api/models'; import { Ad } from './api/models';
import { ActivatedRoute } from '@angular/router';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
...@@ -29,7 +30,10 @@ export class AppComponent implements AfterViewInit { ...@@ -29,7 +30,10 @@ export class AppComponent implements AfterViewInit {
async initAd() { async initAd() {
try { try {
const { data: ad } = await lastValueFrom(this.api.adControllerGetAd()); const adId = new URLSearchParams(window.location.search).get('ad');
const { data: ad } = await lastValueFrom(
this.api.adControllerGetAd(adId ? { id: parseInt(adId) } : undefined)
);
if (ad) { if (ad) {
this.ad = ad; this.ad = ad;
} }
......
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