1- import { Component , OnInit } from '@angular/core' ;
1+ import { Component , OnInit , signal } from '@angular/core' ;
22import { CommonMessage , ConsumerPlan } from "fusio-sdk" ;
33import { FusioService } from "../../service/fusio.service" ;
44import { 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} )
2020export 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
0 commit comments