Browse Source

FIX | Fix logout on contact details page, fix handle stop session

fix/bugs-fix
Oksana Stepanenko 2 years ago
parent
commit
61012fdc41
  1. 4
      src/containers/Contact/contact.page.tsx
  2. 2
      src/containers/Contact/hooks/use-contact.hook.ts
  3. 16
      src/containers/ContactsUsers/index.tsx
  4. 1
      src/services/domain/auth.service.ts
  5. 4
      src/services/domain/contact.service.ts
  6. 2
      src/services/domain/users.service.ts

4
src/containers/Contact/contact.page.tsx

@ -8,9 +8,9 @@ import { useContact } from "./hooks/use-contact.hook"; @@ -8,9 +8,9 @@ import { useContact } from "./hooks/use-contact.hook";
export const ContactPage: FC = () => {
const location: any = useLocation();
const contact = location.state.contactinfo;
const contact = location.state?.contactinfo;
const { contactInfo } = useContact(contact.userId);
const { contactInfo } = useContact(contact?.userId);
return contactInfo ? (
<Container>

2
src/containers/Contact/hooks/use-contact.hook.ts

@ -29,7 +29,7 @@ export const useContact = (contactId: number) => { @@ -29,7 +29,7 @@ export const useContact = (contactId: number) => {
};
useEffect(() => {
fetchContact();
if (contactId) fetchContact();
}, []);
useEffect(() => {

16
src/containers/ContactsUsers/index.tsx

@ -92,14 +92,14 @@ export const ContactsUsers = () => { @@ -92,14 +92,14 @@ export const ContactsUsers = () => {
columns={columnsConfig()}
paginationList={paginationList}
activeColumns={defaultActiveColumnsConfig}
onRowClick={(idx, { userId, firstName, lastName }) => {
console.log(
idx,
{ userId: userId },
{ firstName: firstName },
{ lastName: lastName }
);
}}
// onRowClick={(idx, { userId, firstName, lastName }) => {
// console.log(
// idx,
// { userId: userId },
// { firstName: firstName },
// { lastName: lastName }
// );
// }}
focusedFilterField={focusFilterKey}
onFocusFilterField={(fieldKey: string) =>
setFocusFilterKey(fieldKey)

1
src/services/domain/auth.service.ts

@ -106,6 +106,7 @@ const onLogout = async () => { @@ -106,6 +106,7 @@ const onLogout = async () => {
simpleDispatch(new ClearFilter());
simpleDispatch(new ClearContactsFilter());
simpleDispatch(new UnselectChat());
simpleDispatch(new isLoading({ isLoading: false }));
};
const logout = async (refreshToken: string) => {

4
src/services/domain/contact.service.ts

@ -8,10 +8,10 @@ const fetchContact = async (payload: number): Promise<IUser> => { @@ -8,10 +8,10 @@ const fetchContact = async (payload: number): Promise<IUser> => {
} catch (error) {
console.log("contact fetching error", error);
} finally {
console.log("contactinfo getted successfull");
// console.log("contactinfo getted successfull");
}
};
export const contactsService = {
fetchContact,
fetchContact
};

2
src/services/domain/users.service.ts

@ -20,7 +20,7 @@ const fetchUserStats = async (userId: number) => { @@ -20,7 +20,7 @@ const fetchUserStats = async (userId: number) => {
} catch (error) {
console.log("FETCH USER STATS ERROR", error);
} finally {
console.log("UserStats fetched");
// console.log("UserStats fetched");
}
};

Loading…
Cancel
Save