Skip to content

Commit

Permalink
[fix][sale widget] default non base token sale widget (#1666)
Browse files Browse the repository at this point in the history
Co-authored-by: Jhonatan Gonzalez <jhesgodi@gmail.com>
  • Loading branch information
mimi-imtbl and jhesgodi committed Apr 15, 2024
1 parent ac54ec7 commit 6147d80
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type UseClientConfigParams = {
environmentId: string;
checkout: Checkout | undefined;
provider: Web3Provider | undefined;
defaultCurrency?: 'USDC';
defaultCurrency?: string;
};

export const defaultClientConfig: ClientConfig = {
Expand All @@ -41,7 +41,7 @@ export const useClientConfig = ({
environmentId,
checkout,
provider,
defaultCurrency,
defaultCurrency = 'USDC',
}: UseClientConfigParams) => {
const [selectedCurrency, setSelectedCurrency] = useState<
ClientConfigCurrency | undefined
Expand Down Expand Up @@ -126,7 +126,7 @@ export const useClientConfig = ({
if (clientConfig.currencies.length === 0) return;

const defaultSelectedCurrency = clientConfig.currencies.find((c) => c.name === defaultCurrency)
|| clientConfig.currencies.find((c) => c.base);
|| clientConfig.currencies.find((c) => c.base) || clientConfig.currencies?.[0];
setSelectedCurrency(defaultSelectedCurrency);
}, [defaultCurrency, clientConfig]);

Expand Down

0 comments on commit 6147d80

Please sign in to comment.