Skip to content

Commit

Permalink
fix: config
Browse files Browse the repository at this point in the history
  • Loading branch information
clmntsnr committed Nov 29, 2024
1 parent 33b5e04 commit dbe01a4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
],
"dependencies": {
"@acab/ecsstatic": "^0.8.0",
"@angleprotocol/merkl-api": "0.10.57",
"@angleprotocol/merkl-api": "0.10.58",
"@ariakit/react": "^0.4.12",
"@elysiajs/eden": "^1.1.3",
"@emotion/css": "^11.13.4",
Expand Down
4 changes: 2 additions & 2 deletions src/api/services/opportunity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export abstract class OpportunityService {
): Promise<{ opportunities: Opportunity[]; count: number }> {
//TODO: updates tags to take an array
const opportunities = await OpportunityService.#fetch(async () =>
api.v4.opportunities.index.get({ query: { ...query, tags: config.tags?.[0] } }),
api.v4.opportunities.index.get({ query: Object.assign({ ...query }, config.tags?.[0] ? { tags: config.tags?.[0] }: {}) }),
);
const count = await OpportunityService.#fetch(async () => api.v4.opportunities.count.get({ query }));

Expand All @@ -83,7 +83,7 @@ export abstract class OpportunityService {
);

//TODO: updates tags to take an array
if (!opportunity.tags.includes(config.tags?.[0])) throw new Response("Opportunity inacessible", { status: 403 });
if (config.tags && !opportunity.tags.includes(config.tags?.[0])) throw new Response("Opportunity inacessible", { status: 403 });

return opportunity;
}
Expand Down
5 changes: 5 additions & 0 deletions src/routes/_merkl.(home).(opportunities).tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Container, Space } from "dappkit";
import { ChainService } from "src/api/services/chain.service";
import { OpportunityService } from "src/api/services/opportunity.service";
import OpportunityLibrary from "src/components/element/opportunity/OpportunityLibrary";
import { ErrorContent } from "src/components/layout/ErrorContent";

export async function loader({ request }: LoaderFunctionArgs) {
const { opportunities, count } = await OpportunityService.getManyFromRequest(request);
Expand All @@ -22,3 +23,7 @@ export default function Index() {
</Container>
);
}

export function ErrorBoundary() {
return <ErrorContent />;
}

0 comments on commit dbe01a4

Please sign in to comment.