Skip to content

Commit 33b25d4

Browse files
authored
Merge pull request #2885 from IntersectMBO/fix/2683-error-wrong-api-key-or-paused-project
fix(#2683): handle missing usersnap api key exception
2 parents 7dfeed9 + 394c6cb commit 33b25d4

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ changes.
8585
- Fix usage of trim on missing label
8686
- Fix blank screen when registering as a DRep [Issue 2408](https://github.com/IntersectMBO/govtool/issues/2408)
8787
- Fix type mismatch between sql and haskell code for stake key address
88+
- Handle missing api key exception [Issue 2683](https://github.com/IntersectMBO/govtool/issues/2683)
8889

8990
### Changed
9091

govtool/frontend/src/context/usersnapContext.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,19 @@ export const UsersnapProvider = ({
7373
}, [usersnapApi]);
7474

7575
useEffect(() => {
76-
loadSpace(API_KEY).then((api) => {
77-
api.init(initParams);
78-
setUsersnapApi(api);
79-
});
80-
}, [initParams]);
76+
const initUsersnapSpace = async () => {
77+
if (API_KEY) {
78+
try {
79+
const api = await loadSpace(API_KEY);
80+
api.init(initParams);
81+
setUsersnapApi(api);
82+
} catch (error) {
83+
console.error(error);
84+
}
85+
}
86+
};
87+
initUsersnapSpace();
88+
}, [initParams, API_KEY]);
8189

8290
const value = useMemo(() => ({ openFeedbackWindow }), [openFeedbackWindow]);
8391

0 commit comments

Comments
 (0)