Skip to content

Commit 2fbc1b4

Browse files
committed
refactor: update comments for clarity and improve code formatting across multiple files
1 parent 288874b commit 2fbc1b4

File tree

7 files changed

+36
-41
lines changed

7 files changed

+36
-41
lines changed

Common/Server/Utils/VM/VMRunner.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -176,19 +176,21 @@ export default class VMRunner {
176176
throw new Error(`Unsupported HTTP method: ${method}`);
177177
}
178178

179-
// Convert AxiosHeaders to a plain object before serializing.
180-
// JSON.stringify calls AxiosHeaders.toJSON(key) with a truthy key,
181-
// which makes it join array headers (like set-cookie) with commas.
182-
// This produces invalid Cookie headers when user code forwards them.
179+
/*
180+
* Convert AxiosHeaders to a plain object before serializing.
181+
* JSON.stringify calls AxiosHeaders.toJSON(key) with a truthy key,
182+
* which makes it join array headers (like set-cookie) with commas.
183+
* This produces invalid Cookie headers when user code forwards them.
184+
*/
183185
const plainHeaders: Record<string, unknown> = {};
184186

185187
if (response.headers) {
186188
for (const key of Object.keys(
187189
response.headers as Record<string, unknown>,
188190
)) {
189-
plainHeaders[key] = (
190-
response.headers as Record<string, unknown>
191-
)[key];
191+
plainHeaders[key] = (response.headers as Record<string, unknown>)[
192+
key
193+
];
192194
}
193195
}
194196

MobileApp/src/api/projects.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import apiClient from "./client";
22
import type { AxiosResponse } from "axios";
33
import type { ListResponse, ProjectItem } from "./types";
44

5-
// OneUptime API serializes ObjectID fields as { _type: "ObjectID", value: "uuid" }.
6-
// This helper extracts the plain string value.
5+
/*
6+
* OneUptime API serializes ObjectID fields as { _type: "ObjectID", value: "uuid" }.
7+
* This helper extracts the plain string value.
8+
*/
79
function resolveId(
810
field: string | { _type?: string; value?: string } | undefined,
911
): string {

MobileApp/src/api/sso.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ export interface SSOProvider {
1111
};
1212
}
1313

14-
// OneUptime API serializes ObjectID fields as { _type: "ObjectID", value: "uuid" }.
15-
// This helper extracts the plain string value.
14+
/*
15+
* OneUptime API serializes ObjectID fields as { _type: "ObjectID", value: "uuid" }.
16+
* This helper extracts the plain string value.
17+
*/
1618
function resolveId(
1719
field: string | { _type?: string; value?: string } | undefined,
1820
): string {

MobileApp/src/screens/HomeScreen.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ export default function HomeScreen(): React.JSX.Element {
200200

201201
const onRefresh: () => Promise<void> = async (): Promise<void> => {
202202
lightImpact();
203-
await Promise.all([refetch(), refreshProjects(), refetchOnCall(), checkSsoStatus()]);
203+
await Promise.all([
204+
refetch(),
205+
refreshProjects(),
206+
refetchOnCall(),
207+
checkSsoStatus(),
208+
]);
204209
};
205210

206211
if (!isLoadingProjects && projectList.length === 0) {

MobileApp/src/screens/auth/SSOLoginScreen.tsx

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,7 @@ export default function SSOLoginScreen(): React.JSX.Element {
359359
</View>
360360

361361
{group.items.map(
362-
(
363-
provider: SSOProvider,
364-
index: number,
365-
) => {
362+
(provider: SSOProvider, index: number) => {
366363
return (
367364
<Pressable
368365
key={provider._id}
@@ -371,15 +368,12 @@ export default function SSOLoginScreen(): React.JSX.Element {
371368
}}
372369
style={{
373370
marginBottom:
374-
index < group.items.length - 1
375-
? 10
376-
: 0,
371+
index < group.items.length - 1 ? 10 : 0,
377372
borderRadius: 14,
378373
backgroundColor:
379374
theme.colors.backgroundSecondary,
380375
borderWidth: 1,
381-
borderColor:
382-
theme.colors.borderDefault,
376+
borderColor: theme.colors.borderDefault,
383377
overflow: "hidden",
384378
}}
385379
>
@@ -406,18 +400,15 @@ export default function SSOLoginScreen(): React.JSX.Element {
406400
<Ionicons
407401
name="shield-checkmark-outline"
408402
size={18}
409-
color={
410-
theme.colors.actionPrimary
411-
}
403+
color={theme.colors.actionPrimary}
412404
/>
413405
</View>
414406
<View style={{ flex: 1 }}>
415407
<Text
416408
style={{
417409
fontSize: 15,
418410
fontWeight: "600",
419-
color:
420-
theme.colors.textPrimary,
411+
color: theme.colors.textPrimary,
421412
}}
422413
>
423414
{provider.name}
@@ -427,9 +418,7 @@ export default function SSOLoginScreen(): React.JSX.Element {
427418
style={{
428419
fontSize: 13,
429420
marginTop: 2,
430-
color:
431-
theme.colors
432-
.textSecondary,
421+
color: theme.colors.textSecondary,
433422
}}
434423
>
435424
{provider.description}
@@ -439,9 +428,7 @@ export default function SSOLoginScreen(): React.JSX.Element {
439428
<Ionicons
440429
name="chevron-forward"
441430
size={18}
442-
color={
443-
theme.colors.textTertiary
444-
}
431+
color={theme.colors.textTertiary}
445432
/>
446433
</View>
447434
</Pressable>

MobileApp/src/screens/settings/ProjectsScreen.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,7 @@ export default function ProjectsScreen({
8787
await WebBrowser.warmUpAsync();
8888

8989
const result: WebBrowser.WebBrowserAuthSessionResult =
90-
await WebBrowser.openAuthSessionAsync(
91-
ssoUrl,
92-
"oneuptime://sso-callback",
93-
);
90+
await WebBrowser.openAuthSessionAsync(ssoUrl, "oneuptime://sso-callback");
9491

9592
if (result.type === "success" && result.url) {
9693
const url: URL = new URL(result.url);

MobileApp/src/screens/settings/SSOProviderSelectScreen.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import * as WebBrowser from "expo-web-browser";
1111
import type { NativeStackScreenProps } from "@react-navigation/native-stack";
1212
import { useTheme } from "../../theme";
1313
import { getServerUrl } from "../../storage/serverUrl";
14-
import {
15-
getCachedSsoTokens,
16-
storeSsoToken,
17-
} from "../../storage/ssoTokens";
14+
import { getCachedSsoTokens, storeSsoToken } from "../../storage/ssoTokens";
1815
import type { SettingsStackParamList } from "../../navigation/types";
1916

20-
type Props = NativeStackScreenProps<SettingsStackParamList, "SSOProviderSelect">;
17+
type Props = NativeStackScreenProps<
18+
SettingsStackParamList,
19+
"SSOProviderSelect"
20+
>;
2121

2222
export default function SSOProviderSelectScreen({
2323
route,

0 commit comments

Comments
 (0)