Skip to content

Commit 379fa8f

Browse files
added a login feature flag
1 parent 56a02e9 commit 379fa8f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

app/components/navigation/Bar.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script setup lang="ts">
22
const { currentUser } = useAuth();
3+
const loginFeature = useFeature('login');
34
</script>
45

56
<template>
@@ -10,14 +11,14 @@ const { currentUser } = useAuth();
1011
<span class="max-md:hidden md:text-xl">Mums & Dads</span>
1112
</NavigationLink>
1213
<ul class="flex items-center gap-3">
13-
<li v-if="currentUser === null">
14+
<li v-if="loginFeature && currentUser === null">
1415
<a
1516
class="cursor-pointer font-bold text-white hover:text-white hover:no-underline md:text-xl"
1617
href="/api/auth/signIn">
1718
Log In
1819
</a>
1920
</li>
20-
<li v-if="currentUser !== null">
21+
<li v-if="loginFeature && currentUser !== null">
2122
<NavigationLink to="/portal">
2223
<span class="md:text-xl">Portal</span>
2324
</NavigationLink>

app/composables/useFeature.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export default function (feature: FeatureFlag): boolean {
2+
const url = useRequestURL();
3+
const featureFlags =
4+
new URLSearchParams(url.search).get('featureFlags')?.split(',') || [];
5+
6+
return featureFlags.includes(feature);
7+
}

app/utils/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ declare const stateOptions = [
1919
'closed'
2020
] as const;
2121
declare type State = (typeof stateOptions)[number];
22+
23+
declare type FeatureFlag = 'login';

0 commit comments

Comments
 (0)