Fix oidc routing

This commit is contained in:
Zoe Roux 2024-03-07 00:51:56 +01:00
parent f1707db5fb
commit 7abb66b86f
3 changed files with 8 additions and 2 deletions

View File

@ -24,6 +24,7 @@ import { TextLink, useLink } from "solito/link";
import { useTheme, useYoshiki } from "yoshiki/native";
import type { UrlObject } from "url";
import { alpha } from "./themes";
import { parseNextPath } from "solito/router";
export const A = ({
href,
@ -114,8 +115,11 @@ export const Link = ({
onPress={(e?: any) => {
props?.onPress?.(e);
if (e?.defaultPrevented) return;
if (Platform.OS !== "web" && typeof href === "string" && href?.includes("://"))
Linking.openURL(href);
if (
(Platform.OS !== "web" && typeof href === "string" && href?.includes("://")) ||
(typeof href === "object" && href?.pathname?.includes("://"))
)
Linking.openURL(typeof href === "object" ? parseNextPath(href) : href);
else linkProps.onPress(e);
}}
>

View File

@ -50,6 +50,7 @@ export const OidcLogin = ({ apiUrl }: { apiUrl?: string }) => {
<Button
as={Link}
href={{ pathname: x.link, query: { apiUrl } }}
target="_blank"
key={x.displayName}
licon={
x.logoUrl != null && (

View File

@ -72,6 +72,7 @@ export const ServerUrlPage: QueryPage = () => {
<Link
key={x.displayName}
href={{ pathname: x.link, query: { apiUrl } }}
target="_blank"
{...css({ justifyContent: "center" })}
>
{x.logoUrl != null ? (