Skip to content

Commit

Permalink
fix: debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Meyanis95 committed Sep 23, 2024
1 parent 550a32d commit 79e752e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
3 changes: 2 additions & 1 deletion client/src/pages/claim.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
} from "@anon-aadhaar/react";

const nullifierSeed = process.env.NEXT_PUBLIC_NULLIFIER_SEED || "";
console.log("Seed loaded in the frontend: ", nullifierSeed);

interface IssuerInfo {
did: DID;
Expand Down Expand Up @@ -57,6 +56,8 @@ const App = () => {
const [metamaskWalletAddress, setMetamaskwalletAddress] = useState("");
const [isLoaded, setIsLoaded] = useState(false);

console.log("Seed loaded in the frontend: ", nullifierSeed);

useEffect(() => {
if (anonAadhaar.status === "logged-in") {
setIsConnected(true);
Expand Down
36 changes: 23 additions & 13 deletions client/src/services/issuer.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,60 @@
import axios from 'axios';
import axios from "axios";

const OnchainIssuerNodeHost = process.env.NEXT_PUBLIC_ISSUER_URL || 'http://localhost:8080';
const OnchainIssuerNodeHost =
process.env.NEXT_PUBLIC_ISSUER_URL || "http://localhost:8080";

interface ApiError extends Error {
response?: {
status: number;
};
response?: {
status: number;
};
}

export async function getIssuersList(): Promise<string[]> {
try {
const response = await axios.get<string[]>(`${OnchainIssuerNodeHost}/api/v1/issuers`);
console.log("Issuer loaded in the frontend: ", OnchainIssuerNodeHost);
const response = await axios.get<string[]>(
`${OnchainIssuerNodeHost}/api/v1/issuers`
);
return response.data;
} catch (error) {
throw error;
}
}

interface AuthQRCodeResponse {
data: any;
sessionId: string;
data: any;
sessionId: string;
}

export async function produceAuthQRCode(issuer: string): Promise<AuthQRCodeResponse> {
export async function produceAuthQRCode(
issuer: string
): Promise<AuthQRCodeResponse> {
try {
if (!issuer) {
throw new Error('Issuer is not defined');
throw new Error("Issuer is not defined");
}
console.log("Issuer loaded in the frontend: ", OnchainIssuerNodeHost);
const url = new URL(`${OnchainIssuerNodeHost}/api/v1/requests/auth`);
url.search = new URLSearchParams({ issuer: issuer }).toString();
const response = await axios.get<any>(url.toString());
return {
data: response.data,
sessionId: response.headers['x-id'],
sessionId: response.headers["x-id"],
};
} catch (error) {
throw error;
}
}

interface AuthSessionStatusResponse {
id: string;
id: string;
}

export async function checkAuthSessionStatus(sessionId: string): Promise<AuthSessionStatusResponse | null> {
export async function checkAuthSessionStatus(
sessionId: string
): Promise<AuthSessionStatusResponse | null> {
try {
console.log("Issuer loaded in the frontend: ", OnchainIssuerNodeHost);
const url = new URL(`${OnchainIssuerNodeHost}/api/v1/status`);
url.search = new URLSearchParams({ id: sessionId }).toString();
const response = await axios.get<any>(url.toString());
Expand Down

0 comments on commit 79e752e

Please sign in to comment.