Skip to content

Commit 322c644

Browse files
authored
Merge pull request #285 from fairdataihub/staging
fix: announcements and function being undefined
2 parents a10930b + f1d3b42 commit 322c644

File tree

3 files changed

+7
-17
lines changed

3 files changed

+7
-17
lines changed

src/renderer/src/scripts/globals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1433,7 +1433,7 @@ window.openDropdownPrompt = async (ev, dropdown, show_timer = true) => {
14331433
// there is an account; but check check that the valid api key in the default profile is for the user's current workspace
14341434
// IMP NOTE: There can be different API Keys for each workspace and the user can switch between workspaces. Therefore a valid api key
14351435
// under the default profile does not mean that key is associated with the user's current workspace.
1436-
let matching = await defaultProfileMatchesCurrentWorkspace();
1436+
let matching = await window.defaultProfileMatchesCurrentWorkspace();
14371437
if (!matching) {
14381438
log.info("Default api key is for a different workspace");
14391439
await switchToCurrentWorkspace();

src/renderer/src/scripts/others/http-error-handler/error-handler.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const authenticationError = (error) => {
7171
return error.response.status === 401;
7272
};
7373

74-
const defaultProfileMatchesCurrentWorkspace = async () => {
74+
window.defaultProfileMatchesCurrentWorkspace = async () => {
7575
let userInfo = await api.getUserInformation();
7676
let currentWorkspace = userInfo["preferredOrganization"];
7777
// the default profile value, if one exists, has the current workspace id
@@ -87,7 +87,7 @@ const defaultProfileMatchesCurrentWorkspace = async () => {
8787
};
8888

8989
const switchToCurrentWorkspace = async () => {
90-
let workspacesMatch = await defaultProfileMatchesCurrentWorkspace();
90+
let workspacesMatch = await window.defaultProfileMatchesCurrentWorkspace();
9191

9292
if (workspacesMatch) {
9393
// obsolete/invalid api key and secret needs to be replaced
@@ -169,10 +169,4 @@ const switchToCurrentWorkspace = async () => {
169169
await window.addBfAccount(null, true);
170170
};
171171

172-
export {
173-
clientError,
174-
userErrorMessage,
175-
authenticationError,
176-
switchToCurrentWorkspace,
177-
defaultProfileMatchesCurrentWorkspace,
178-
};
172+
export { clientError, userErrorMessage, authenticationError, switchToCurrentWorkspace };

src/renderer/src/scripts/others/renderer.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,7 @@ import {
4646
} from "../analytics/curation-analytics";
4747
import createEventDataPrepareMetadata from "../analytics/prepare-metadata-analytics";
4848
import determineDatasetLocation, { Destinations } from "../analytics/analytics-utils";
49-
import {
50-
clientError,
51-
userErrorMessage,
52-
defaultProfileMatchesCurrentWorkspace,
53-
} from "./http-error-handler/error-handler";
49+
import { clientError, userErrorMessage } from "./http-error-handler/error-handler";
5450
import hasConnectedAccountWithPennsieve from "./authentication/auth";
5551
import api from "./api/api";
5652
import {
@@ -408,7 +404,7 @@ const startupServerAndApiCheck = async () => {
408404
if (launchAnnouncement) {
409405
await checkForAnnouncements("announcements");
410406
launchAnnouncement = false;
411-
nodeStorage.setItem("announcements", false);
407+
window.electron.ipcRenderer.invoke("set-nodestorage-key", "announcements", false);
412408
}
413409

414410
apiVersionChecked = true;
@@ -579,7 +575,7 @@ window.run_pre_flight_checks = async (check_update = true) => {
579575
// check that the valid api key in the default profile is for the user's current workspace
580576
// IMP NOTE: There can be different API Keys for each workspace and the user can switch between workspaces. Therefore a valid api key
581577
// under the default profile does not mean that key is associated with the user's current workspace.
582-
let matching = await defaultProfileMatchesCurrentWorkspace();
578+
let matching = await window.defaultProfileMatchesCurrentWorkspace();
583579
if (!matching) {
584580
log.info("Default api key is for a different workspace");
585581
await switchToCurrentWorkspace();

0 commit comments

Comments
 (0)