mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-29 00:36:22 +02:00
♻️ Switch to app router (#922)
This commit is contained in:
parent
41f85279bb
commit
95feb9f01a
181 changed files with 2507 additions and 2494 deletions
|
@ -1,5 +1,5 @@
|
|||
import Link, { LinkProps } from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { usePathname, useRouter } from "next/navigation";
|
||||
import React from "react";
|
||||
|
||||
export const LoginLink = React.forwardRef<
|
||||
|
@ -7,6 +7,7 @@ export const LoginLink = React.forwardRef<
|
|||
React.PropsWithChildren<Omit<LinkProps, "href"> & { className?: string }>
|
||||
>(function LoginLink({ children, ...props }, ref) {
|
||||
const router = useRouter();
|
||||
const pathname = usePathname() ?? "/";
|
||||
return (
|
||||
<Link
|
||||
ref={ref}
|
||||
|
@ -15,7 +16,7 @@ export const LoginLink = React.forwardRef<
|
|||
onClick={async (e) => {
|
||||
e.preventDefault();
|
||||
props.onClick?.(e);
|
||||
router.push("/login?callbackUrl=" + encodeURIComponent(router.asPath));
|
||||
router.push("/login?callbackUrl=" + encodeURIComponent(pathname));
|
||||
}}
|
||||
>
|
||||
{children}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue