Skip to content

Commit

Permalink
fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Doraemon012 committed Aug 25, 2024
1 parent d92dc4f commit ddd94a8
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/screens/MemberDetail/MemberDetail.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import { useQuery } from '@apollo/client';
import { useTranslation } from 'react-i18next';
import { useLocation } from 'react-router-dom';
Expand Down Expand Up @@ -59,17 +59,32 @@ const MemberDetail: React.FC<MemberDetailProps> = ({ id }): JSX.Element => {
keyPrefix: 'memberDetail',
});

const isMounted = useRef(false);
const [state, setState] = useState({});

const location = useLocation();
const { getItem } = useLocalStorage();
const currentUrl = location.state?.id || getItem('id') || id;

useEffect(() => {
isMounted.current = true;
const superAdmin = getItem('SuperAdmin');
superAdmin
? (document.title = t('title_superadmin'))
: (document.title = t('title'));

return () => {
isMounted.current = false;
};
}, [getItem, t]);

// useEffect(() => {
// const superAdmin = getItem('SuperAdmin');
// superAdmin
// ? (document.title = t('title_superadmin'))
// : (document.title = t('title'));
// }, [getItem, t]);

const { data: user, loading: loading } = useQuery(USER_DETAILS, {
variables: { id: currentUrl },
});
Expand Down

0 comments on commit ddd94a8

Please sign in to comment.