Skip to content

Commit 3492591

Browse files
authored
chore: npx prettier (#138)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent f533f4c commit 3492591

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2947
-2303
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
# vpn-frontend
2-
VPN as a Service frontend
2+
3+
VPN as a Service frontend

eslint.config.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import js from '@eslint/js'
2-
import globals from 'globals'
3-
import reactHooks from 'eslint-plugin-react-hooks'
4-
import reactRefresh from 'eslint-plugin-react-refresh'
5-
import tseslint from 'typescript-eslint'
1+
import js from "@eslint/js";
2+
import globals from "globals";
3+
import reactHooks from "eslint-plugin-react-hooks";
4+
import reactRefresh from "eslint-plugin-react-refresh";
5+
import tseslint from "typescript-eslint";
66

77
export default tseslint.config(
8-
{ ignores: ['dist'] },
8+
{ ignores: ["dist"] },
99
{
1010
extends: [js.configs.recommended, ...tseslint.configs.recommended],
11-
files: ['**/*.{ts,tsx}'],
11+
files: ["**/*.{ts,tsx}"],
1212
languageOptions: {
1313
ecmaVersion: 2020,
1414
globals: globals.browser,
1515
},
1616
plugins: {
17-
'react-hooks': reactHooks,
18-
'react-refresh': reactRefresh,
17+
"react-hooks": reactHooks,
18+
"react-refresh": reactRefresh,
1919
},
2020
rules: {
2121
...reactHooks.configs.recommended.rules,
22-
'react-refresh/only-export-components': [
23-
'warn',
22+
"react-refresh/only-export-components": [
23+
"warn",
2424
{ allowConstantExport: true },
2525
],
2626
},
2727
},
28-
)
28+
);

functions/api/[[path]].ts

Lines changed: 37 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,76 @@
1-
export async function onRequest({ request, params, env }: {
1+
export async function onRequest({
2+
request,
3+
params,
4+
env,
5+
}: {
26
request: Request;
37
params: { path: string[] };
48
env: {
59
API_URL?: string;
610
CARDANO_NETWORK?: string;
711
};
812
}) {
9-
if (request.method === 'OPTIONS') {
13+
if (request.method === "OPTIONS") {
1014
return new Response(null, {
1115
headers: {
12-
'Access-Control-Allow-Origin': '*',
13-
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',
14-
'Access-Control-Allow-Headers': 'Content-Type',
16+
"Access-Control-Allow-Origin": "*",
17+
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
18+
"Access-Control-Allow-Headers": "Content-Type",
1519
},
1620
});
1721
}
1822

1923
const url = new URL(request.url);
20-
const apiBaseUrl = env.API_URL || 'https://preprod-api.b7s.services';
21-
const cardanoNetwork = env.CARDANO_NETWORK || 'preprod';
22-
const apiUrl = `${apiBaseUrl}/api/${params.path.join('/')}${url.search}`;
23-
24-
console.log('Proxying request to:', apiUrl);
25-
console.log('Request method:', request.method);
26-
console.log('Cardano Network:', cardanoNetwork);
27-
24+
const apiBaseUrl = env.API_URL || "https://preprod-api.b7s.services";
25+
const cardanoNetwork = env.CARDANO_NETWORK || "preprod";
26+
const apiUrl = `${apiBaseUrl}/api/${params.path.join("/")}${url.search}`;
27+
28+
console.log("Proxying request to:", apiUrl);
29+
console.log("Request method:", request.method);
30+
console.log("Cardano Network:", cardanoNetwork);
31+
2832
const response = await fetch(apiUrl, {
2933
method: request.method,
3034
headers: request.headers,
3135
body: request.body,
32-
redirect: 'manual'
36+
redirect: "manual",
3337
});
3438

35-
console.log('Upstream response status:', response.status);
36-
console.log('Upstream response headers:', Object.fromEntries(response.headers.entries()));
39+
console.log("Upstream response status:", response.status);
40+
console.log(
41+
"Upstream response headers:",
42+
Object.fromEntries(response.headers.entries()),
43+
);
3744

38-
if (params.path.join('/') === 'client/profile' && response.status === 302) {
39-
const location = response.headers.get('location');
45+
if (params.path.join("/") === "client/profile" && response.status === 302) {
46+
const location = response.headers.get("location");
4047
if (location) {
4148
return new Response(location, {
4249
status: 200,
4350
headers: {
44-
'Content-Type': 'text/plain',
45-
'Access-Control-Allow-Origin': '*',
51+
"Content-Type": "text/plain",
52+
"Access-Control-Allow-Origin": "*",
4653
},
4754
});
4855
}
4956
}
5057

5158
const responseHeaders = new Headers();
52-
59+
5360
response.headers.forEach((value, key) => {
5461
responseHeaders.set(key, value);
5562
});
56-
57-
responseHeaders.set('Access-Control-Allow-Origin', '*');
58-
responseHeaders.set('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
59-
responseHeaders.set('Access-Control-Allow-Headers', 'Content-Type');
63+
64+
responseHeaders.set("Access-Control-Allow-Origin", "*");
65+
responseHeaders.set(
66+
"Access-Control-Allow-Methods",
67+
"GET, POST, PUT, DELETE, OPTIONS",
68+
);
69+
responseHeaders.set("Access-Control-Allow-Headers", "Content-Type");
6070

6171
const responseBody = await response.text();
62-
console.log('Response body length:', responseBody.length);
63-
console.log('Response body preview:', responseBody.substring(0, 200));
72+
console.log("Response body length:", responseBody.length);
73+
console.log("Response body preview:", responseBody.substring(0, 200));
6474

6575
return new Response(responseBody, {
6676
status: response.status,

index.html

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,19 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/logomark.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<link rel="preconnect" href="https://fonts.googleapis.com">
8-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9-
<link href="https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,100..900;1,100..900&family=IBM+Plex+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
10-
<link rel="preload" href="/hero-center-graphic.png" as="image" type="image/png" fetchpriority="high" />
7+
<link rel="preconnect" href="https://fonts.googleapis.com" />
8+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
9+
<link
10+
href="https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,100..900;1,100..900&family=IBM+Plex+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;1,100;1,200;1,300;1,400;1,500;1,600;1,700&display=swap"
11+
rel="stylesheet"
12+
/>
13+
<link
14+
rel="preload"
15+
href="/hero-center-graphic.png"
16+
as="image"
17+
type="image/png"
18+
fetchpriority="high"
19+
/>
1120
<title>NABU</title>
1221
</head>
1322
<body>

src/App.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import Navigation from './components/Navigation'
2-
import AppRoutes from './routes'
3-
import { QueryClientProvider } from '@tanstack/react-query'
4-
import { queryClient } from './api'
5-
import { Toaster } from 'react-hot-toast'
1+
import Navigation from "./components/Navigation";
2+
import AppRoutes from "./routes";
3+
import { QueryClientProvider } from "@tanstack/react-query";
4+
import { queryClient } from "./api";
5+
import { Toaster } from "react-hot-toast";
66

77
const VpnApp = () => {
88
return (
@@ -13,7 +13,7 @@ const VpnApp = () => {
1313
<Toaster />
1414
</div>
1515
</QueryClientProvider>
16-
)
17-
}
16+
);
17+
};
1818

19-
export default VpnApp
19+
export default VpnApp;

0 commit comments

Comments
 (0)