Skip to content

Commit

Permalink
Fixed delegation actions names (#1234)
Browse files Browse the repository at this point in the history
Fixed delegation actions names
  • Loading branch information
ygrik authored Apr 7, 2021
1 parent 276ccd3 commit 51d97bb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ProductService } from "../../../../../services/productService";
import { UsersService } from "../../../../../services/usersService";
import { SubscriptionState } from "../../../../../contracts/subscription";
import { TenantService } from "../../../../../services/tenantService";
import { DelegationParameters, DelegationAction } from "../../../../../contracts/tenantSettings";
import { DelegationParameters, DelegationActionPath } from "../../../../../contracts/tenantSettings";
import { RouteHelper } from "../../../../../routing/routeHelper";

@RuntimeComponent({
Expand Down Expand Up @@ -149,7 +149,7 @@ export class ProductSubscribe {
const delegation = new URLSearchParams();
delegation.append(DelegationParameters.ProductId, Utils.getResourceName("products", productId));
delegation.append(DelegationParameters.UserId, Utils.getResourceName("users", userId));
await this.router.navigateTo(`/${DelegationAction.subscribe}?${delegation.toString()}`);
await this.router.navigateTo(`/${DelegationActionPath.subscribe}?${delegation.toString()}`);
return;
}

Expand Down
10 changes: 5 additions & 5 deletions src/components/users/profile/ko/runtime/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Component, RuntimeComponent, OnMounted } from "@paperbits/common/ko/dec
import { Router } from "@paperbits/common/routing/router";
import { User } from "../../../../../models/user";
import { UsersService } from "../../../../../services/usersService";
import { DelegationParameters, DelegationAction } from "../../../../../contracts/tenantSettings";
import { DelegationParameters, DelegationActionPath } from "../../../../../contracts/tenantSettings";
import { TenantService } from "../../../../../services/tenantService";
import { pageUrlChangePassword } from "../../../../../constants";
import { Utils } from "../../../../../utils";
Expand Down Expand Up @@ -67,7 +67,7 @@ export class Profile {
this.setUser(model);
}

private async isDelegationEnabled(action: DelegationAction): Promise<boolean> {
private async isDelegationEnabled(action: DelegationActionPath): Promise<boolean> {
if (!this.user()) {
return false;
}
Expand Down Expand Up @@ -103,7 +103,7 @@ export class Profile {
}

public async toggleEdit(): Promise<void> {
const isDelegationEnabled = await this.isDelegationEnabled(DelegationAction.changeProfile);
const isDelegationEnabled = await this.isDelegationEnabled(DelegationActionPath.changeProfile);
if (isDelegationEnabled) {
return;
}
Expand All @@ -116,7 +116,7 @@ export class Profile {
}

public async toggleEditPassword(): Promise<void> {
const isDelegationEnabled = await this.isDelegationEnabled(DelegationAction.changePassword);
const isDelegationEnabled = await this.isDelegationEnabled(DelegationActionPath.changePassword);
if (isDelegationEnabled) {
return;
}
Expand Down Expand Up @@ -158,7 +158,7 @@ export class Profile {
}

public async closeAccount(): Promise<void> {
const isDelegationEnabled = await this.isDelegationEnabled(DelegationAction.closeAccount);
const isDelegationEnabled = await this.isDelegationEnabled(DelegationActionPath.closeAccount);
if (isDelegationEnabled) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SubscriptionListItem } from "./subscriptionListItem";
import { UsersService } from "../../../../../services/usersService";
import { ProductService } from "../../../../../services/productService";
import { TenantService } from "../../../../../services/tenantService";
import { DelegationParameters, DelegationAction } from "../../../../../contracts/tenantSettings";
import { DelegationParameters, DelegationActionPath } from "../../../../../contracts/tenantSettings";
import { Utils } from "../../../../../utils";
import { Router } from "@paperbits/common/routing/router";

Expand Down Expand Up @@ -123,7 +123,7 @@ export class Subscriptions {
if (isDelegationEnabled) {
const delegation = new URLSearchParams();
delegation.append(DelegationParameters.SubscriptionId, Utils.getResourceName("subscriptions", subscriptionId));
this.router.navigateTo(`/${DelegationAction.unsubscribe}?${delegation.toString()}`);
this.router.navigateTo(`/${DelegationActionPath.unsubscribe}?${delegation.toString()}`);

return true;
}
Expand Down
8 changes: 7 additions & 1 deletion src/contracts/tenantSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface TenantSettings {
userRegistrationTermsConsentRequired: boolean;
}

export enum DelegationAction {
export enum DelegationActionPath {
signIn = "signin",
signUp = "signup",
subscribe = "delegation-subscribe",
Expand All @@ -24,6 +24,12 @@ export enum DelegationAction {
closeAccount = "delegation-closeAccount",
signOut = "signout"
}

export enum DelegationAction {
signIn = "SignIn",
signUp = "SignUp",
signOut = "SignOut"
}

export enum DelegationParameters {
ReturnUrl = "returnUrl",
Expand Down

0 comments on commit 51d97bb

Please sign in to comment.