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

View File

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

View File

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