mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 20:59:05 +00:00
Compare commits
2 Commits
v0.24.0
...
release-pl
| Author | SHA1 | Date | |
|---|---|---|---|
| 893d02075f | |||
| f0ee7b531a |
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [0.24.1](https://github.com/Monadical-SAS/reflector/compare/v0.24.0...v0.24.1) (2025-12-19)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* logout redirect ([#802](https://github.com/Monadical-SAS/reflector/issues/802)) ([f0ee7b5](https://github.com/Monadical-SAS/reflector/commit/f0ee7b531a0911f214ccbb84d399e9a6c9b700c0))
|
||||||
|
|
||||||
## [0.24.0](https://github.com/Monadical-SAS/reflector/compare/v0.23.2...v0.24.0) (2025-12-18)
|
## [0.24.0](https://github.com/Monadical-SAS/reflector/compare/v0.23.2...v0.24.0) (2025-12-18)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,13 +2,19 @@
|
|||||||
|
|
||||||
import { Spinner, Link } from "@chakra-ui/react";
|
import { Spinner, Link } from "@chakra-ui/react";
|
||||||
import { useAuth } from "../lib/AuthProvider";
|
import { useAuth } from "../lib/AuthProvider";
|
||||||
|
import { usePathname } from "next/navigation";
|
||||||
|
import { getLogoutRedirectUrl } from "../lib/auth";
|
||||||
|
|
||||||
export default function UserInfo() {
|
export default function UserInfo() {
|
||||||
const auth = useAuth();
|
const auth = useAuth();
|
||||||
|
const pathname = usePathname();
|
||||||
const status = auth.status;
|
const status = auth.status;
|
||||||
const isLoading = status === "loading";
|
const isLoading = status === "loading";
|
||||||
const isAuthenticated = status === "authenticated";
|
const isAuthenticated = status === "authenticated";
|
||||||
const isRefreshing = status === "refreshing";
|
const isRefreshing = status === "refreshing";
|
||||||
|
|
||||||
|
const callbackUrl = getLogoutRedirectUrl(pathname);
|
||||||
|
|
||||||
return isLoading ? (
|
return isLoading ? (
|
||||||
<Spinner size="xs" className="mx-3" />
|
<Spinner size="xs" className="mx-3" />
|
||||||
) : !isAuthenticated && !isRefreshing ? (
|
) : !isAuthenticated && !isRefreshing ? (
|
||||||
@@ -26,7 +32,7 @@ export default function UserInfo() {
|
|||||||
<Link
|
<Link
|
||||||
href="#"
|
href="#"
|
||||||
className="font-light px-2"
|
className="font-light px-2"
|
||||||
onClick={() => auth.signOut({ callbackUrl: "/" })}
|
onClick={() => auth.signOut({ callbackUrl })}
|
||||||
>
|
>
|
||||||
Log out
|
Log out
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -18,3 +18,8 @@ export const LOGIN_REQUIRED_PAGES = [
|
|||||||
export const PROTECTED_PAGES = new RegExp(
|
export const PROTECTED_PAGES = new RegExp(
|
||||||
LOGIN_REQUIRED_PAGES.map((page) => `^${page}$`).join("|"),
|
LOGIN_REQUIRED_PAGES.map((page) => `^${page}$`).join("|"),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export function getLogoutRedirectUrl(pathname: string): string {
|
||||||
|
const transcriptPagePattern = /^\/transcripts\/[^/]+$/;
|
||||||
|
return transcriptPagePattern.test(pathname) ? pathname : "/";
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user