feat: images and products loading optimization

This commit is contained in:
2025-12-08 19:22:10 +03:00
parent c64170f2d8
commit bf674473e9
7 changed files with 316 additions and 239 deletions

View File

@@ -15,7 +15,7 @@ export const apiFetch = ofetch.create({
if (data) {
const encoded = encodeBase64Unicode(data);
options.headers = {
...(isDev && { 'XDEBUG_TRIGGER': 'PHPSTORM' }),
...(isDev && {'XDEBUG_TRIGGER': 'PHPSTORM'}),
...options.headers,
'X-Telegram-InitData': encoded,
};
@@ -131,4 +131,16 @@ export async function heartbeat() {
return await ftch('heartbeat');
}
export async function fetchProductById(productId) {
return await ftch('product_show', {
id: productId,
});
}
export async function fetchProductImages(productId) {
return await ftch('getProductImages', {
id: productId,
});
}
export default ftch;