Skip to content

Commit eefd861

Browse files
committed
fix plans and provide markdown
1 parent 0ca23ed commit eefd861

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

projects/fusio-sdk/src/lib/component/subscription/subscription.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11

2-
<fusio-message [response]="response"></fusio-message>
2+
<fusio-message [response]="response()"></fusio-message>
33

44
<button class="btn btn-primary" (click)="doBillingPortal()">Billing portal</button>
55

66
<hr>
77

8-
@for (plan of plans; track plan.id) {
8+
@for (plan of plans(); track plan.id) {
99
<div class="card float-start" style="width:16rem;margin-right:1rem;margin-bottom:1rem">
1010
<h5 class="card-header">{{plan.name}}</h5>
1111
<div class="card-body">

projects/fusio-sdk/src/lib/component/subscription/subscription.component.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, OnInit} from '@angular/core';
1+
import {Component, OnInit, signal} from '@angular/core';
22
import {CommonMessage, ConsumerPlan} from "fusio-sdk";
33
import {FusioService} from "../../service/fusio.service";
44
import {CurrencyPipe, LocationStrategy} from "@angular/common";
@@ -13,21 +13,21 @@ import {MarkdownComponent} from "ngx-markdown";
1313
imports: [
1414
MessageComponent,
1515
CurrencyPipe,
16-
MarkdownComponent
16+
MarkdownComponent,
1717
],
1818
styleUrls: ['./subscription.component.css']
1919
})
2020
export class SubscriptionComponent implements OnInit {
2121

2222
currencyCode: string = 'EUR';
23-
plans?: Array<ConsumerPlan>
24-
response?: CommonMessage;
23+
plans = signal<Array<ConsumerPlan>>([]);
24+
response = signal<CommonMessage|undefined>(undefined);
2525

2626
constructor(private fusio: FusioService, private location: LocationStrategy, private error: ErrorService, private config: ConfigService) { }
2727

2828
async ngOnInit(): Promise<void> {
2929
const response = await this.fusio.getClient().consumer().plan().getAll(0, 1024);
30-
this.plans = response.entry;
30+
this.plans.set(response.entry || []);
3131
this.currencyCode = this.config.getPaymentCurrency();
3232
}
3333

@@ -46,7 +46,7 @@ export class SubscriptionComponent implements OnInit {
4646
throw new Error('You can only visit the billing portal once you have successfully purchased a subscription');
4747
}
4848
} catch (error) {
49-
this.response = this.error.convert(error);
49+
this.response.set(this.error.convert(error));
5050
}
5151
}
5252

@@ -64,7 +64,7 @@ export class SubscriptionComponent implements OnInit {
6464
location.href = response.approvalUrl;
6565
}
6666
} catch (error) {
67-
this.response = this.error.convert(error);
67+
this.response.set(this.error.convert(error));
6868
}
6969
}
7070

src/app/app.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ import {ApiService} from "./api.service";
77
import {routes} from './app.routes';
88
import {ConfigBuilder} from "./config-builder";
99
import {FUSIO_CONFIG} from "../../projects/fusio-sdk/src/lib/config/config";
10+
import {provideMarkdown} from "ngx-markdown";
1011

1112
export const appConfig: ApplicationConfig = {
1213
providers: [
1314
provideBrowserGlobalErrorListeners(),
1415
provideZonelessChangeDetection(),
1516
provideRouter(routes),
1617
provideHttpClient(withFetch()),
18+
provideMarkdown(),
1719
{
1820
provide: SDK,
1921
useExisting: ApiService

0 commit comments

Comments
 (0)