Overview & recent fixes, auth updates, SWR fixes
This commit is contained in:
parent
7df947f35a
commit
8d86db882d
29 changed files with 1252 additions and 1221 deletions
|
|
@ -18,12 +18,24 @@ export const ZammadWrapper: FC<ZammadWrapperProps> = ({
|
|||
const router = useRouter();
|
||||
const { data: session } = useSession({ required: true });
|
||||
const timeoutRef = useRef(null);
|
||||
const [hashCheckComplete, setHashCheckComplete] = useState(false);
|
||||
const [authenticated, setAuthenticated] = useState(false);
|
||||
const [display, setDisplay] = useState("none");
|
||||
const url = `/zammad${path}`;
|
||||
const id = url.replace(/[^a-zA-Z0-9]/g, "");
|
||||
|
||||
useEffect(() => {
|
||||
const hash = window?.location?.hash;
|
||||
if (hash && hash.startsWith("#ticket/zoom/")) {
|
||||
const ticketID = hash.split("/").pop();
|
||||
router.push(`/tickets/${ticketID}`);
|
||||
}
|
||||
setHashCheckComplete(true);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!hashCheckComplete) return;
|
||||
|
||||
const checkAuthenticated = async () => {
|
||||
const res = await fetch("/zammad/auth/sso", {
|
||||
method: "GET",
|
||||
|
|
@ -38,7 +50,7 @@ export const ZammadWrapper: FC<ZammadWrapperProps> = ({
|
|||
};
|
||||
|
||||
checkAuthenticated();
|
||||
}, [path]);
|
||||
}, [path, hashCheckComplete]);
|
||||
|
||||
useEffect(() => {
|
||||
if (session === null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue