Skip to content

Commit

Permalink
feat(SPV-1420): make totp work
Browse files Browse the repository at this point in the history
  • Loading branch information
dzolt-4chain committed Feb 4, 2025
1 parent 75592e2 commit 742d617
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/providers/contacts/provider.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { searchContacts } from '@/api/requests/contact';
import { Contact } from '@/api/types/contact';
import { PaginationParams } from '@/api/types';
import { usePikeContactsEnabled } from '@/hooks/useFeatureFlags';
import { FC, PropsWithChildren, createContext, useCallback, useEffect, useMemo, useState } from 'react';
import { useAuthorization } from '../authorization';
import { errorMessage } from '@/utils/errorMessage';
Expand All @@ -19,11 +18,9 @@ export const ContactsProvider: FC<PropsWithChildren> = ({ children }) => {
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
const [contacts, setContacts] = useState<Contact[] | null>(null);
const pikeContactsEnabled = usePikeContactsEnabled();
const { authorization } = useAuthorization();

const load = useCallback(async () => {
if (!pikeContactsEnabled || !authorization) {
if (!authorization) {
return;
}
setLoading(true);
Expand All @@ -35,14 +32,15 @@ export const ContactsProvider: FC<PropsWithChildren> = ({ children }) => {
sort: 'asc',
};
const contactsResponse = await searchContacts(paginationParams);
console.log(contactsResponse);
setContacts(contactsResponse.content);
} catch (e: unknown) {
setContacts(null);
setError(errorMessage(e));
} finally {
setLoading(false);
}
}, [authorization, pikeContactsEnabled]);
}, [authorization]);

const refresh = useCallback(() => {
load();
Expand Down

0 comments on commit 742d617

Please sign in to comment.