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 {
* This method doesn't expect any request body.
*/
adControllerGetAd$Response(params?: {
id?: number;
}): Observable<StrictHttpResponse<AdReturnMessageDto>> {
const rb = new RequestBuilder(this.rootUrl, ApiService.AdControllerGetAdPath, 'get');
if (params) {
rb.query('id', params.id, {});
}
return this.http.request(rb.build({
......@@ -166,6 +168,7 @@ export class ApiService extends BaseService {
* This method doesn't expect any request body.
*/
adControllerGetAd(params?: {
id?: number;
}): Observable<AdReturnMessageDto> {
return this.adControllerGetAd$Response(params).pipe(
......
......@@ -5,6 +5,7 @@ import { ApiService } from './api/services/api.service';
import { lastValueFrom } from 'rxjs';
import * as moment from 'moment';
import { Ad } from './api/models';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-root',
......@@ -29,7 +30,10 @@ export class AppComponent implements AfterViewInit {
async initAd() {
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) {
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