Skip to content

Commit d6f2f18

Browse files
sethiddenMarcin Kwiatkowski
authored andcommitted
fix: setCurrency can take customQuery
1 parent 433acfe commit d6f2f18

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

packages/theme/composables/useCurrency/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
ref, computed, useContext,
33
} from '@nuxtjs/composition-api';
44
import { UseCurrency, UseCurrencyErrors } from '~/composables/useCurrency/useCurrency';
5-
import { ComposableFunctionArgs } from '~/composables/types';
5+
import { ComposableFunctionArgs, CustomQuery } from '~/composables/types';
66
import { Logger } from '~/helpers/logger';
77
import { useConfigStore } from '~/stores/config';
88

@@ -13,7 +13,7 @@ const useCurrency = (): UseCurrency => {
1313
const configStore = useConfigStore();
1414
const currency = computed(() => configStore.currency);
1515

16-
const load = async (params?: ComposableFunctionArgs<{}>) => {
16+
const load = async (params?: ComposableFunctionArgs<CustomQuery>) => {
1717
error.value.load = null;
1818
loading.value = true;
1919

@@ -32,14 +32,14 @@ const useCurrency = (): UseCurrency => {
3232
}
3333
};
3434

35-
const change = async (params: ComposableFunctionArgs<{ id: string }>) => {
35+
const change = (params: ComposableFunctionArgs<{ id: string }>) => {
3636
error.value.change = null;
3737
loading.value = true;
3838

3939
Logger.debug('useCurrency/change');
4040

4141
try {
42-
await app.$vsf.$magento.config.state.setCurrency(params.id);
42+
app.$vsf.$magento.config.state.setCurrency(params.id);
4343
} catch (err) {
4444
Logger.debug('[ERROR] useCurrency/change', err);
4545
error.value.change = err;

packages/theme/composables/useCurrency/useCurrency.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export interface UseCurrencyErrors {
99

1010
export interface UseCurrency {
1111
load: (params?: ComposableFunctionArgs<{}>) => Promise<void>;
12-
change: (params: ComposableFunctionArgs<{ id: string }>) => Promise<void>;
12+
change: (params: ComposableFunctionArgs<{ id: string }>) => void;
1313
currency: ComputedRef<Currency>;
1414
loading: Ref<boolean>;
1515
error: Ref<UseCurrencyErrors>;

0 commit comments

Comments
 (0)