Skip to content

Commit

Permalink
further env var tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterHW committed Apr 30, 2024
1 parent c354e05 commit 0c5b065
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/grant-explorer/src/features/api/gap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useState } from "react";
import useSWR from "swr";
import { Hex } from "viem";

const indexerUrl = process.env.REACT_APP_KARMA_GAP_INDEXER_URL as string;
const indexerUrl = process.env.REACT_APP_KARMA_GAP_INDEXER_URL as string || "";

export interface IGrantStatus {
uid: Hex;
Expand Down Expand Up @@ -33,7 +33,7 @@ export function useGap(projectId?: string) {
const [grants, setGrants] = useState<IGapGrant[]>([]);

const getGrantsFor = async (projectRegistryId: string) => {
if (indexerUrl === undefined) throw new Error("GAP Indexer url not set.");
if (indexerUrl === "") throw new Error("GAP Indexer url not set.");
try {
const items: IGapGrant[] = await fetch(
`${indexerUrl}/grants/external-id/${projectRegistryId}`
Expand Down
4 changes: 2 additions & 2 deletions packages/grant-explorer/src/features/api/oso.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import useSWR from "swr";
import { Hex } from "viem";
import { gql, GraphQLClient } from "graphql-request";

const osoApiKey = process.env.REACT_APP_OSO_API_KEY as string;
const osoApiKey = process.env.REACT_APP_OSO_API_KEY as string || "";
const osoUrl = "https://opensource-observer.hasura.app/v1/graphql";
const graphQLClient = new GraphQLClient(osoUrl, {
headers: {
Expand Down Expand Up @@ -88,7 +88,7 @@ export function useOSO(projectGithub?: string) {
const [stats, setStats] = useState<IOSOStats | null>(null);

const getStatsFor = async (projectRegistryGithub: string) => {
if (osoApiKey === undefined) throw new Error("OpenSourceObserver API key not set.");
if (osoApiKey === "") throw new Error("OpenSourceObserver API key not set.");
const queryId = gql`{
artifacts_by_project(where: {artifact_name: {_ilike: "%${projectRegistryGithub}/%"}}
distinct_on: project_id
Expand Down

0 comments on commit 0c5b065

Please sign in to comment.