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.
20 lines
522 B
TypeScript
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 {};
|
|
}
|