Skip to content

Commit

Permalink
fix: update home endpoints with generated api (#740)
Browse files Browse the repository at this point in the history
* fix: use auto generated endpoints for homepage

* refactor: fix tests
  • Loading branch information
pyphilia authored Jan 28, 2025
1 parent 00da1e6 commit 066fe63
Show file tree
Hide file tree
Showing 14 changed files with 16,559 additions and 27 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ node_modules
.husky
.nyc_output
.yarn
src/client
9 changes: 4 additions & 5 deletions cypress/support/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const mockGetRecentCollections = (
pathname: `/${ITEMS_ROUTE}/collections/recent`,
},
({ reply }) => {
reply(recentCollections);
reply({ hits: recentCollections });
},
).as('getRecentCollections');
};
Expand Down Expand Up @@ -459,11 +459,10 @@ export const mockGetLikedItems = (
}

const memberId = new URLSearchParams(new URL(url).search).get('memberId');
const results = itemLikes.filter(
({ creator }) => creator?.id === memberId,
);
const results =
itemLikes.filter(({ creator }) => creator?.id === memberId) ?? [];

return reply(results || []);
return reply(results);
},
).as('getLikedItemsForMember');
};
Expand Down
8 changes: 8 additions & 0 deletions hey-api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { CreateClientConfig } from '@hey-api/client-fetch';

import { GRAASP_API_HOST } from './src/config/env';

export const createClientConfig: CreateClientConfig = (config) => ({
...config,
baseUrl: GRAASP_API_HOST,
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@graasp/stylis-plugin-rtl": "2.2.0",
"@graasp/translations": "1.43.0",
"@graasp/ui": "5.5.1",
"@hey-api/client-fetch": "0.7.2",
"@mui/icons-material": "6.1.5",
"@mui/lab": "6.0.0-beta.13",
"@mui/material": "6.1.5",
Expand Down
Loading

0 comments on commit 066fe63

Please sign in to comment.