Skip to content

Commit

Permalink
fix: use post instead of put (#1604)
Browse files Browse the repository at this point in the history
  • Loading branch information
peintnermax committed Apr 16, 2021
1 parent 7131131 commit a3abdec
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion console/src/app/modules/features/features.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h2>{{'FEATURES.TIER.TITLE' | translate}}</h2>
<mat-spinner class="spinner" diameter="20" *ngIf="customerLoading || stripeLoading"></mat-spinner>
<div class="detail" *ngIf="stripeCustomer">
<p class="title">{{'FEATURES.TIER.DETAILS' | translate}}
<a (click)="updateCustomer()">{{'ACTIONS.EDIT' | translate}}</a>
<a (click)="setCustomer()">{{'ACTIONS.EDIT' | translate}}</a>
</p>
<p>{{stripeCustomer?.contact}}</p>
<p *ngIf="stripeCustomer.company">{{stripeCustomer?.company}}</p>
Expand Down
4 changes: 2 additions & 2 deletions console/src/app/modules/features/features.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class FeaturesComponent implements OnDestroy {
this.sub.unsubscribe();
}

public updateCustomer(): void {
public setCustomer(): void {
const dialogRefPhone = this.dialog.open(PaymentInfoDialogComponent, {
data: {
customer: this.stripeCustomer,
Expand All @@ -102,7 +102,7 @@ export class FeaturesComponent implements OnDestroy {
if (customer) {
console.log(customer);
this.stripeCustomer = customer;
this.subService.updateCustomer(this.org.id, customer).then(() => {
this.subService.setCustomer(this.org.id, customer).then(() => {
this.getLinkToStripe();
}).catch(console.error);
}
Expand Down
7 changes: 2 additions & 5 deletions console/src/app/services/subscription.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class SubscriptionService {
const accessToken = this.storageService.getItem(accessTokenStorageKey);
return this.http.get(`${serviceUrl}/redirect`, {
headers: {
// 'Content-Type': 'application/json; charset=utf-8',
[authorizationKey]: `${bearerPrefix} ${accessToken}`,
},
params: {
Expand All @@ -53,7 +52,6 @@ export class SubscriptionService {
const accessToken = this.storageService.getItem(accessTokenStorageKey);
return this.http.get(`${serviceUrl}/customer`, {
headers: {
// 'Content-Type': 'application/json; charset=utf-8',
[authorizationKey]: `${bearerPrefix} ${accessToken}`,
},
params: {
Expand All @@ -66,15 +64,14 @@ export class SubscriptionService {
});
}

public updateCustomer(orgId: string, body: StripeCustomer): Promise<any> {
public setCustomer(orgId: string, body: StripeCustomer): Promise<any> {
return this.http.get('./assets/environment.json')
.toPromise().then((data: any) => {
if (data && data.subscriptionServiceUrl) {
const serviceUrl = data.subscriptionServiceUrl;
const accessToken = this.storageService.getItem(accessTokenStorageKey);
return this.http.put(`${serviceUrl}/customer`, body, {
return this.http.post(`${serviceUrl}/customer`, body, {
headers: {
// 'Content-Type': 'application/json; charset=utf-8',
[authorizationKey]: `${bearerPrefix} ${accessToken}`,
},
params: {
Expand Down

0 comments on commit a3abdec

Please sign in to comment.