schon/storefront/app/composables/promocodes/usePromocodes.ts
Alexandr SaVBaD Waltz e65e7b7d73 **chore(storefront): apply consistent code formatting and improve readability**
Refactored multiple files for code styling consistency, using proper indentation and spacing to align with team standards. Improved readability and maintainability across composables, Apollo plugin, and localization files.

Enhancements:
- Standardized import and function indentation across all composables.
- Updated `biome.json` schema to the latest version (v2.4.4) for tool compatibility.
- Organized code blocks in Apollo plugin for better understandability.

No functional changes introduced—this is a non-breaking, code refinement commit.
2026-02-28 17:41:25 +03:00

20 lines
522 B
TypeScript

import { GET_PROMOCODES } from '@graphql/queries/standalone/promocodes';
import type { IPromocodesResponse } from '@types';
export async function usePromocodes() {
const promocodeStore = usePromocodeStore();
const { data, error } = await useAsyncQuery<IPromocodesResponse>(GET_PROMOCODES);
if (!error.value && data.value?.promocodes.edges) {
promocodeStore.setPromocodes(data.value.promocodes.edges);
}
watch(error, (err) => {
if (err) {
console.error('usePromocodes error:', err);
}
});
return {};
}