Skip to content

Commit

Permalink
fix(config): fix subscription config for routing
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasRichel committed Nov 10, 2021
1 parent 9c02785 commit 75fc53f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
import { computed, inject } from "vue";
import { useRouter } from "vue-router";
import { useListFilter } from "@/composables/list-filter.js";
import { IS_SUBCRIPTION_ENABLED } from "@/config/subscription.js";
import { IS_SUBSCRIPTION_ENABLED } from "@/config/subscription.js";
import routeNames from "@/router/route-names.js";
import { useOrganizations } from "@/state/organizations.js";
// Components
Expand Down Expand Up @@ -81,7 +81,7 @@ export default {
return {
// References
displayedSpaces,
isSubscriptionEnabled: IS_SUBCRIPTION_ENABLED,
isSubscriptionEnabled: IS_SUBSCRIPTION_ENABLED,
localState,
searchText,
// Methods
Expand Down
7 changes: 4 additions & 3 deletions src/config/subscription.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const IS_SUBCRIPTION_ENABLED =
process.env.VUE_APP_SUBSCRIPTION_ENABLED === "true";
const SUBSCRIPTION_ENABLED = process.env.VUE_APP_SUBSCRIPTION_ENABLED;
const FREE_PLAN_STORAGE = process.env.VUE_APP_FREE_PLAN_STORAGE;
const PRO_PLAN_ID = process.env.VUE_APP_PRO_PLAN_ID;
const PRO_PLAN_STORAGE = process.env.VUE_APP_PRO_PLAN_STORAGE;
const DATAPACK_PLAN_ID = process.env.VUE_APP_DATAPACK_PLAN_ID;

const IS_SUBSCRIPTION_ENABLED = SUBSCRIPTION_ENABLED === "true";

export {
IS_SUBCRIPTION_ENABLED,
IS_SUBSCRIPTION_ENABLED,
FREE_PLAN_STORAGE,
PRO_PLAN_ID,
PRO_PLAN_STORAGE,
Expand Down
5 changes: 2 additions & 3 deletions src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { createRouter, createWebHistory } from "vue-router";
import { IS_SUBSCRIPTION_ENABLED } from "@/config/subscription.js";
import routeNames from "./route-names.js";
import legacyRoutes from "./legacy.js";
import subscriptionRoutes from "./subscription.js";
Expand Down Expand Up @@ -113,9 +114,7 @@ const routes = [
}
},
// Add subscription routes if enabled
...(process.env.VUE_APP_SUBSCRIPTION_ENABLED === "true"
? subscriptionRoutes
: []),
...(IS_SUBSCRIPTION_ENABLED ? subscriptionRoutes : []),
// Add legacy routes for retro-compatibility
...legacyRoutes,
{
Expand Down
4 changes: 2 additions & 2 deletions src/views/dashboard/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

<script>
import { useRouter } from "vue-router";
import { IS_SUBCRIPTION_ENABLED } from "@/config/subscription.js";
import { IS_SUBSCRIPTION_ENABLED } from "@/config/subscription.js";
import routeNames from "@/router/route-names.js";
import { useProjects } from "@/state/projects.js";
import { useSpaces } from "@/state/spaces.js";
Expand Down Expand Up @@ -104,7 +104,7 @@ export default {
return {
// References
isSubscriptionEnabled: IS_SUBCRIPTION_ENABLED,
isSubscriptionEnabled: IS_SUBSCRIPTION_ENABLED,
projects: userProjects,
spaces: userSpaces,
// Methods
Expand Down
4 changes: 2 additions & 2 deletions src/views/project-board/ProjectBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
import { onBeforeMount, ref, watch } from "vue";
import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router";
import { IS_SUBCRIPTION_ENABLED } from "@/config/subscription.js";
import { IS_SUBSCRIPTION_ENABLED } from "@/config/subscription.js";
import { useProjects } from "@/state/projects.js";
import { useSession } from "@/state/session.js";
import { useSpaces } from "@/state/spaces.js";
Expand Down Expand Up @@ -126,7 +126,7 @@ export default {
// References
currentTab,
currentView,
isSubscriptionEnabled: IS_SUBCRIPTION_ENABLED,
isSubscriptionEnabled: IS_SUBSCRIPTION_ENABLED,
tabs,
space: currentSpace,
spaceInfo,
Expand Down
4 changes: 2 additions & 2 deletions src/views/space-board/SpaceBoard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
import { useListFilter } from "@/composables/list-filter.js";
import { useListSort } from "@/composables/list-sort.js";
import { useSidePanel } from "@/composables/side-panel.js";
import { IS_SUBCRIPTION_ENABLED } from "@/config/subscription.js";
import { IS_SUBSCRIPTION_ENABLED } from "@/config/subscription.js";
import { useProjects } from "@/state/projects.js";
import { useSpaces } from "@/state/spaces.js";
Expand Down Expand Up @@ -119,7 +119,7 @@ export default {
return {
// References
invitations: spaceInvitations,
isSubscriptionEnabled: IS_SUBCRIPTION_ENABLED,
isSubscriptionEnabled: IS_SUBSCRIPTION_ENABLED,
projects: displayedProjects,
searchText,
space: currentSpace,
Expand Down
4 changes: 2 additions & 2 deletions src/views/user-spaces/UserSpaces.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import { useRouter } from "vue-router";
import { useListFilter } from "@/composables/list-filter.js";
import { useListSort } from "@/composables/list-sort.js";
import { useSidePanel } from "@/composables/side-panel.js";
import { IS_SUBCRIPTION_ENABLED } from "@/config/subscription.js";
import { IS_SUBSCRIPTION_ENABLED } from "@/config/subscription.js";
import routeNames from "@/router/route-names.js";
import { useOrganizations } from "@/state/organizations.js";
import { useSpaces } from "@/state/spaces.js";
Expand Down Expand Up @@ -108,7 +108,7 @@ export default {
return {
// References
isSubscriptionEnabled: IS_SUBCRIPTION_ENABLED,
isSubscriptionEnabled: IS_SUBSCRIPTION_ENABLED,
organizations: userOrganizations,
searchText,
spaces: displayedSpaces,
Expand Down

0 comments on commit 75fc53f

Please sign in to comment.