Skip to content

Commit

Permalink
Credit report improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
hide-on-bush-x committed Nov 18, 2022
1 parent 5b1c222 commit 6054eb1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/common/helpers/provider/masa-context.tsx
Expand Up @@ -36,6 +36,8 @@ export interface MasaShape {
scope?: string[];
company?: string;
handleCreateCreditReport?: () => void;
creditReports: any[] | null,
loadCreditReports: () => void;
}

export const MasaContextProvider = ({
Expand All @@ -57,8 +59,24 @@ export const MasaContextProvider = ({
const [loggedIn, setLoggedIn] = useState<boolean>(false);
const [modalCallback, setModalCallback] = useState<any>(null);

const [creditReports, setCreditReports] = useState<any>(null);

const [scope, setScope] = useState<string[]>([]);

const loadCreditReports = async () => {
setLoading(true);
const cr = await masaInstance?.creditScore.list();
if (cr?.length) {
setCreditReports(cr);
}
setLoading(false);
};

useEffect(() => {
if (masaInstance) {
loadCreditReports();
}
}, [masaInstance]);
const connect = useCallback(
(options?: { scope?: string[]; callback?: Function }) => {
setModalOpen(true);
Expand Down Expand Up @@ -212,6 +230,8 @@ export const MasaContextProvider = ({
scope,
company,
handleCreateCreditReport,
creditReports,
loadCreditReports
};

return (
Expand Down

0 comments on commit 6054eb1

Please sign in to comment.