Overview & recent fixes, auth updates, SWR fixes

This commit is contained in:
Darren Clarke 2023-11-10 14:17:09 +01:00
parent 7df947f35a
commit 8d86db882d
29 changed files with 1252 additions and 1221 deletions

View file

@ -96,7 +96,7 @@ const SearchResult: FC<SearchResultProps> = ({ props, option }) => {
export const SearchBox: FC = () => {
const [open, setOpen] = useState(false);
const [selectedValue, setSelectedValue] = useState(null);
const [searchTerms, setSearchTerms] = useState(null);
const [searchTerms, setSearchTerms] = useState("");
const pathname = usePathname();
const router = useRouter();
const { data, error }: any = useSWR({

View file

@ -45,6 +45,10 @@ export const StyledDataGrid: FC<StyledDataGridProps> = ({
height,
".MuiDataGrid-row": {
cursor: "pointer",
"&:hover": {
backgroundColor: "#1982fc33 !important",
fontWeight: "bold",
},
},
".MuiDataGrid-row:nth-of-type(1n)": {
backgroundColor: "#f3f3f3",
@ -71,7 +75,7 @@ export const StyledDataGrid: FC<StyledDataGridProps> = ({
density="compact"
pagination
initialState={{
pagination: { paginationModel: { pageSize: 20 } },
pagination: { paginationModel: { pageSize: 25 } },
}}
pageSizeOptions={[5, 10, 25]}
paginationMode="client"

View file

@ -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) {