-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bea208b
commit a0cb3f7
Showing
7 changed files
with
59 additions
and
51 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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
'use server'; | ||
import {ContextState} from '@coveo/headless-react/ssr-commerce'; | ||
|
||
import {ContextOptions} from '@coveo/headless/ssr-commerce'; | ||
import {cookies} from 'next/headers'; | ||
|
||
export async function getContext() { | ||
return { | ||
language: cookies().get('language')?.value || 'en', | ||
country: cookies().get('country')?.value || 'US', | ||
currency: | ||
(cookies().get('currency')?.value as ContextOptions['currency']) || 'USD', | ||
}; | ||
} | ||
export const defaultContext: { | ||
language: string; | ||
country: string; | ||
currency: ContextState['currency']; | ||
} = { | ||
language: 'en', | ||
country: 'US', | ||
currency: 'USD', | ||
}; |