Skip to content

Commit 2f3399f

Browse files
committed
chore: fixed lint issues in eid wallet
1 parent 41dd53a commit 2f3399f

File tree

6 files changed

+528
-505
lines changed

6 files changed

+528
-505
lines changed

infrastructure/eid-wallet/src/lib/global/controllers/evault.ts

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface MetaEnvelopeResponse {
2121
metaEnvelope: {
2222
id: string;
2323
ontology: string;
24+
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
2425
parsed: any;
2526
};
2627
};
@@ -62,11 +63,9 @@ export class VaultController {
6263
/**
6364
* Set the profile creation status
6465
*/
65-
set profileCreationStatus(status:
66-
| "idle"
67-
| "loading"
68-
| "success"
69-
| "failed") {
66+
set profileCreationStatus(
67+
status: "idle" | "loading" | "success" | "failed"
68+
) {
7069
this.#profileCreationStatus = status;
7170
}
7271

@@ -88,14 +87,14 @@ export class VaultController {
8887
await this.createUserProfileInEVault(
8988
vault.ename,
9089
displayName,
91-
vault.ename,
90+
vault.ename
9291
);
9392

9493
this.profileCreationStatus = "success";
9594
} catch (error) {
9695
console.error(
9796
"Failed to create UserProfile in eVault (retry):",
98-
error,
97+
error
9998
);
10099
this.profileCreationStatus = "failed";
101100
throw error;
@@ -108,7 +107,7 @@ export class VaultController {
108107
private async resolveEndpoint(w3id: string): Promise<string> {
109108
try {
110109
const response = await axios.get(
111-
new URL(`resolve?w3id=${w3id}`, PUBLIC_REGISTRY_URL).toString(),
110+
new URL(`resolve?w3id=${w3id}`, PUBLIC_REGISTRY_URL).toString()
112111
);
113112
return new URL("/graphql", response.data.uri).toString();
114113
} catch (error) {
@@ -135,7 +134,7 @@ export class VaultController {
135134
ename: string,
136135
displayName: string,
137136
w3id: string,
138-
maxRetries = 10,
137+
maxRetries = 10
139138
): Promise<void> {
140139
console.log("attempting");
141140
const username = ename.replace("@", "");
@@ -160,7 +159,7 @@ export class VaultController {
160159
const client = await this.ensureClient(w3id);
161160

162161
console.log(
163-
`Attempting to create UserProfile in eVault (attempt ${attempt}/${maxRetries})`,
162+
`Attempting to create UserProfile in eVault (attempt ${attempt}/${maxRetries})`
164163
);
165164

166165
const response = await client.request<MetaEnvelopeResponse>(
@@ -171,23 +170,23 @@ export class VaultController {
171170
payload: userProfile,
172171
acl: ["*"],
173172
},
174-
},
173+
}
175174
);
176175

177176
console.log(
178177
"UserProfile created successfully in eVault:",
179-
response.storeMetaEnvelope.metaEnvelope.id,
178+
response.storeMetaEnvelope.metaEnvelope.id
180179
);
181180
return;
182181
} catch (error) {
183182
console.error(
184183
`Failed to create UserProfile in eVault (attempt ${attempt}/${maxRetries}):`,
185-
error,
184+
error
186185
);
187186

188187
if (attempt === maxRetries) {
189188
console.error(
190-
"Max retries reached, giving up on UserProfile creation",
189+
"Max retries reached, giving up on UserProfile creation"
191190
);
192191
throw error;
193192
}
@@ -200,10 +199,12 @@ export class VaultController {
200199
}
201200
}
202201

203-
set vault(vault:
204-
| Promise<Record<string, string> | undefined>
205-
| Record<string, string>
206-
| undefined) {
202+
set vault(
203+
vault:
204+
| Promise<Record<string, string> | undefined>
205+
| Record<string, string>
206+
| undefined
207+
) {
207208
if (vault instanceof Promise)
208209
vault
209210
.then(async (resolvedUser) => {
@@ -220,13 +221,13 @@ export class VaultController {
220221
await this.createUserProfileInEVault(
221222
resolvedUser?.ename as string,
222223
displayName as string,
223-
resolvedUser?.ename as string,
224+
resolvedUser?.ename as string
224225
);
225226
this.profileCreationStatus = "success";
226227
} catch (error) {
227228
console.error(
228229
"Failed to create UserProfile in eVault:",
229-
error,
230+
error
230231
);
231232
this.profileCreationStatus = "failed";
232233
}
@@ -251,26 +252,26 @@ export class VaultController {
251252
await this.createUserProfileInEVault(
252253
vault.ename,
253254
displayName,
254-
vault.ename,
255+
vault.ename
255256
);
256257
this.profileCreationStatus = "success";
257258
} catch (error) {
258259
console.error(
259260
"Failed to get user data or create UserProfile:",
260-
error,
261+
error
261262
);
262263
// Fallback to using ename as display name
263264
try {
264265
await this.createUserProfileInEVault(
265266
vault.ename,
266267
vault.ename,
267-
vault.ename,
268+
vault.ename
268269
);
269270
this.profileCreationStatus = "success";
270271
} catch (fallbackError) {
271272
console.error(
272273
"Failed to create UserProfile in eVault (fallback):",
273-
fallbackError,
274+
fallbackError
274275
);
275276
this.profileCreationStatus = "failed";
276277
}

infrastructure/eid-wallet/src/routes/(app)/main/+page.svelte

Lines changed: 67 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,78 @@
11
<script lang="ts">
2-
import { goto } from "$app/navigation";
3-
import { Hero, IdentityCard } from "$lib/fragments";
4-
import type { GlobalState } from "$lib/global";
5-
import { Drawer } from "$lib/ui";
6-
import * as Button from "$lib/ui/Button";
7-
import { QrCodeIcon, Settings02Icon } from "@hugeicons/core-free-icons";
8-
import { HugeiconsIcon } from "@hugeicons/svelte";
9-
import { getContext, onMount, type Snippet } from "svelte";
10-
import { Shadow } from "svelte-loading-spinners";
11-
import { onDestroy } from "svelte";
12-
import QrCode from "svelte-qrcode";
13-
14-
let userData: Record<string, unknown> | undefined = $state(undefined);
15-
let greeting: string | undefined = $state(undefined);
16-
let ename: string | undefined = $state(undefined);
17-
let profileCreationStatus: "idle" | "loading" | "success" | "failed" =
18-
$state("idle");
19-
20-
let shareQRdrawerOpen = $state(false);
21-
let statusInterval: any = $state(undefined);
22-
23-
function shareQR() {
24-
alert("QR Code shared!");
25-
shareQRdrawerOpen = false;
26-
}
27-
28-
async function retryProfileCreation() {
29-
try {
30-
await globalState.vaultController.retryProfileCreation();
31-
} catch (error) {
32-
console.error("Retry failed:", error);
2+
import { goto } from "$app/navigation";
3+
import { Hero, IdentityCard } from "$lib/fragments";
4+
import type { GlobalState } from "$lib/global";
5+
import { Drawer } from "$lib/ui";
6+
import * as Button from "$lib/ui/Button";
7+
import { QrCodeIcon, Settings02Icon } from "@hugeicons/core-free-icons";
8+
import { HugeiconsIcon } from "@hugeicons/svelte";
9+
import { type Snippet, getContext, onMount } from "svelte";
10+
import { onDestroy } from "svelte";
11+
import { Shadow } from "svelte-loading-spinners";
12+
import QrCode from "svelte-qrcode";
13+
14+
let userData: Record<string, unknown> | undefined = $state(undefined);
15+
let greeting: string | undefined = $state(undefined);
16+
let ename: string | undefined = $state(undefined);
17+
let profileCreationStatus: "idle" | "loading" | "success" | "failed" =
18+
$state("idle");
19+
20+
let shareQRdrawerOpen = $state(false);
21+
let statusInterval: ReturnType<typeof setInterval> | undefined =
22+
$state(undefined);
23+
24+
function shareQR() {
25+
alert("QR Code shared!");
26+
shareQRdrawerOpen = false;
3327
}
34-
}
3528
36-
const globalState = getContext<() => GlobalState>("globalState")();
29+
async function retryProfileCreation() {
30+
try {
31+
await globalState.vaultController.retryProfileCreation();
32+
} catch (error) {
33+
console.error("Retry failed:", error);
34+
}
35+
}
3736
38-
onMount(() => {
39-
// Load initial data
40-
(async () => {
41-
const userInfo = await globalState.userController.user;
42-
const isFake = await globalState.userController.isFake;
43-
userData = { ...userInfo, isFake };
44-
const vaultData = await globalState.vaultController.vault;
45-
ename = vaultData?.ename;
46-
})();
37+
const globalState = getContext<() => GlobalState>("globalState")();
4738
48-
// Get initial profile creation status
49-
profileCreationStatus = globalState.vaultController.profileCreationStatus;
39+
onMount(() => {
40+
// Load initial data
41+
(async () => {
42+
const userInfo = await globalState.userController.user;
43+
const isFake = await globalState.userController.isFake;
44+
userData = { ...userInfo, isFake };
45+
const vaultData = await globalState.vaultController.vault;
46+
ename = vaultData?.ename;
47+
})();
5048
51-
// Set up a watcher for profile creation status changes
52-
const checkStatus = () => {
49+
// Get initial profile creation status
5350
profileCreationStatus =
5451
globalState.vaultController.profileCreationStatus;
55-
};
56-
57-
// Check status periodically
58-
statusInterval = setInterval(checkStatus, 1000);
59-
60-
const currentHour = new Date().getHours();
61-
greeting =
62-
currentHour > 17
63-
? "Good Evening"
64-
: currentHour > 12
65-
? "Good Afternoon"
66-
: "Good Morning";
67-
});
68-
69-
onDestroy(() => {
70-
if (statusInterval) {
71-
clearInterval(statusInterval);
72-
}
73-
});
52+
53+
// Set up a watcher for profile creation status changes
54+
const checkStatus = () => {
55+
profileCreationStatus =
56+
globalState.vaultController.profileCreationStatus;
57+
};
58+
59+
// Check status periodically
60+
statusInterval = setInterval(checkStatus, 1000);
61+
62+
const currentHour = new Date().getHours();
63+
greeting =
64+
currentHour > 17
65+
? "Good Evening"
66+
: currentHour > 12
67+
? "Good Afternoon"
68+
: "Good Morning";
69+
});
70+
71+
onDestroy(() => {
72+
if (statusInterval) {
73+
clearInterval(statusInterval);
74+
}
75+
});
7476
</script>
7577

7678
{#if profileCreationStatus === "loading"}

0 commit comments

Comments
 (0)