-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize Provider store data, UI store and flags store from cookies…
… in a plugin (#4231) * Update header internal test Signed-off-by: Olga Bulat <obulat@gmail.com> * Wait for full navigation in header-internal e2e test Signed-off-by: Olga Bulat <obulat@gmail.com> * Revert header changes Signed-off-by: Olga Bulat <obulat@gmail.com> * Initialize ui and flags from cookies at request time Signed-off-by: Olga Bulat <obulat@gmail.com> * Add source name in decode-media-data * Split sessionFeatures from features when setting cookies for tests * Update tapes * Refactor VByLine params * Update content report form test * Remove redundant default icon class * Remove lastUpdated --------- Signed-off-by: Olga Bulat <obulat@gmail.com>
- Loading branch information
Showing
23 changed files
with
709 additions
and
624 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineNuxtMiddleware } from "@nuxtjs/composition-api" | ||
|
||
import { useFeatureFlagStore } from "~/stores/feature-flag" | ||
|
||
/** | ||
* On every page navigation, update the feature flags from query. | ||
*/ | ||
export default defineNuxtMiddleware(async ({ $pinia, query }) => { | ||
const featureFlagStore = useFeatureFlagStore($pinia) | ||
featureFlagStore.initFromQuery(query) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { defineNuxtPlugin } from "@nuxtjs/composition-api" | ||
|
||
import { useFeatureFlagStore } from "~/stores/feature-flag" | ||
import { useUiStore } from "~/stores/ui" | ||
import { useProviderStore } from "~/stores/provider" | ||
|
||
/** | ||
* Initialize the feature flag and UI stores from cookies and query parameters on every request. | ||
*/ | ||
export default defineNuxtPlugin(async ({ $cookies, $pinia }) => { | ||
/* Provider store */ | ||
const providerStore = useProviderStore($pinia) | ||
await providerStore.fetchProviders() | ||
|
||
/* Feature flag store */ | ||
const featureFlagStore = useFeatureFlagStore($pinia) | ||
featureFlagStore.initFromCookies($cookies.get("features") ?? {}) | ||
featureFlagStore.initFromCookies($cookies.get("sessionFeatures") ?? {}) | ||
|
||
/* UI store */ | ||
const uiStore = useUiStore($pinia) | ||
uiStore.initFromCookies($cookies.get("ui") ?? {}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.