refactor: update API response handling across multiple queries to ensure compliance with ADR-028
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 16m53s

- Removed direct return of json.data in favor of structured error handling.
- Implemented checks for success and data array in useActivityLogQuery, useBestSalePricesQuery, useBrandsQuery, useCategoriesQuery, useFlyerItemsForFlyersQuery, useFlyerItemsQuery, useFlyersQuery, useLeaderboardQuery, useMasterItemsQuery, usePriceHistoryQuery, useShoppingListsQuery, useSuggestedCorrectionsQuery, and useWatchedItemsQuery.
- Updated unit tests to reflect changes in expected behavior when API response does not conform to the expected structure.
- Updated package.json to use the latest version of @sentry/vite-plugin.
- Adjusted vite.config.ts for local development SSL configuration.
- Added self-signed SSL certificate and key for local development.
This commit is contained in:
2026-01-17 21:45:51 -08:00
parent 822d6d1c3c
commit 3d91d59b9c
19 changed files with 263 additions and 128 deletions

View File

@@ -1,9 +1,23 @@
// vite.config.ts
import path from 'path';
// import fs from 'fs'; // Unused when nginx handles SSL
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import { sentryVitePlugin } from '@sentry/vite-plugin';
// HTTPS configuration for local development (optional, disabled when using nginx proxy)
// const httpsConfig = (() => {
// const keyPath = '/app/certs/localhost.key';
// const certPath = '/app/certs/localhost.crt';
// if (fs.existsSync(keyPath) && fs.existsSync(certPath)) {
// return {
// key: fs.readFileSync(keyPath),
// cert: fs.readFileSync(certPath),
// };
// }
// return undefined;
// })();
// Ensure NODE_ENV is set to 'test' for all Vitest runs.
process.env.NODE_ENV = 'test';
@@ -59,8 +73,9 @@ export default defineConfig({
: []),
],
server: {
port: 3000,
port: 5173, // Internal port, nginx proxies on 3000
host: '0.0.0.0',
// https: httpsConfig, // Disabled - nginx handles SSL
},
resolve: {
alias: {