mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-01 04:34:50 -04:00
Fix oidc links opening two times on web
This commit is contained in:
parent
c6dd7203bb
commit
25b7903c37
@ -95,12 +95,13 @@ export const PressableFeedback = forwardRef<View, PressableProps>(function Feedb
|
|||||||
});
|
});
|
||||||
|
|
||||||
export const Link = ({
|
export const Link = ({
|
||||||
href,
|
href: link,
|
||||||
replace,
|
replace,
|
||||||
target,
|
target,
|
||||||
children,
|
children,
|
||||||
...props
|
...props
|
||||||
}: { href?: string | UrlObject | null; target?: string; replace?: boolean } & PressableProps) => {
|
}: { href?: string | UrlObject | null; target?: string; replace?: boolean } & PressableProps) => {
|
||||||
|
const href = link && typeof link === "object" ? parseNextPath(link) : link;
|
||||||
const linkProps = useLink({
|
const linkProps = useLink({
|
||||||
href: href ?? "#",
|
href: href ?? "#",
|
||||||
replace,
|
replace,
|
||||||
@ -115,11 +116,7 @@ export const Link = ({
|
|||||||
onPress={(e?: any) => {
|
onPress={(e?: any) => {
|
||||||
props?.onPress?.(e);
|
props?.onPress?.(e);
|
||||||
if (e?.defaultPrevented) return;
|
if (e?.defaultPrevented) return;
|
||||||
if (
|
if (Platform.OS !== "web" && href?.includes("://")) 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);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
|
@ -50,7 +50,6 @@ 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 && (
|
||||||
|
@ -71,7 +71,6 @@ 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 ? (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user