Refactor BaseUrl string conversion

We're only using this as a string, so no need to convert it to an URL.
This commit is contained in:
Rūdolfs Ošiņš
2024-02-23 15:46:28 +00:00
parent 8f43a57984
commit 41435951c1
8 changed files with 21 additions and 24 deletions
+3 -3
View File
@@ -509,9 +509,9 @@
style:border-radius="var(--border-radius-small">
<ErrorMessage
title="Failed to load diff for this revision"
description="Make sure you are able to connect to the seed <code>${utils
.baseUrlToUrl(api.baseUrl)
.toString()}</code>"
description="Make sure you are able to connect to the seed <code>${utils.baseUrlToString(
api.baseUrl,
)}</code>"
{error} />
</div>
{/if}
+3 -3
View File
@@ -10,7 +10,7 @@
import { COMMITS_PER_PAGE } from "./router";
import { HttpdClient } from "@httpd-client";
import { baseUrlToUrl } from "@app/lib/utils";
import { baseUrlToString } from "@app/lib/utils";
import { groupCommits } from "@app/lib/commit";
import Button from "@app/components/Button.svelte";
@@ -160,9 +160,9 @@
<div class="message">
<ErrorMessage
title="Couldn't load commits"
description="Make sure you are able to connect to the seed <code>${baseUrlToUrl(
description="Make sure you are able to connect to the seed <code>${baseUrlToString(
api.baseUrl,
).toString()}</code>"
)}</code>"
{error} />
</div>
{/if}
+3 -3
View File
@@ -5,7 +5,7 @@
import { ISSUES_PER_PAGE } from "./router";
import { closeFocused } from "@app/components/Popover.svelte";
import { httpdStore } from "@app/lib/httpd";
import { baseUrlToUrl, isLocal } from "@app/lib/utils";
import { baseUrlToString, isLocal } from "@app/lib/utils";
import capitalize from "lodash/capitalize";
import Button from "@app/components/Button.svelte";
@@ -176,9 +176,9 @@
{#if error}
<ErrorMessage
title="Couldn't load issues"
description="Please make sure you are able to connect to the seed <code>${baseUrlToUrl(
description="Please make sure you are able to connect to the seed <code>${baseUrlToString(
api.baseUrl,
).toString()}</code>"
)}</code>"
{error} />
{/if}
+3 -3
View File
@@ -6,7 +6,7 @@
import { PATCHES_PER_PAGE } from "./router";
import { httpdStore } from "@app/lib/httpd";
import { baseUrlToUrl, isLocal } from "@app/lib/utils";
import { baseUrlToString, isLocal } from "@app/lib/utils";
import Button from "@app/components/Button.svelte";
import DropdownList from "@app/components/DropdownList.svelte";
@@ -195,9 +195,9 @@
{#if error}
<ErrorMessage
title="Couldn't load patches"
description="Please make sure you are able to connect to the seed <code>${baseUrlToUrl(
description="Please make sure you are able to connect to the seed <code>${baseUrlToString(
api.baseUrl,
).toString()}</code>"
)}</code>"
{error} />
{/if}
+2 -2
View File
@@ -1,7 +1,7 @@
import type { ErrorRoute, NotFoundRoute } from "@app/lib/router/definitions";
import type { ProjectRoute } from "@app/views/projects/router";
import { baseUrlToUrl, isLocal } from "@app/lib/utils";
import { baseUrlToString, isLocal } from "@app/lib/utils";
import { ResponseParseError, ResponseError } from "@httpd-client/lib/fetcher";
import { httpdStore } from "@app/lib/httpd";
import { get } from "svelte/store";
@@ -10,7 +10,7 @@ export function handleError(
error: Error | ResponseParseError | ResponseError,
route: ProjectRoute,
): NotFoundRoute | ErrorRoute {
const url = baseUrlToUrl(route.node);
const url = baseUrlToString(route.node);
if (error instanceof ResponseError && error.status === 404) {
let subject;