diff --git a/src/components/selectCredential.tsx b/src/components/selectCredential.tsx
index 2729f25..62ec46c 100644
--- a/src/components/selectCredential.tsx
+++ b/src/components/selectCredential.tsx
@@ -22,7 +22,8 @@ export function SelectCredential(): JSX.Element {
if (error) {
toast.error(error?.message);
} else {
- const _credentials = data?.credentials?.filter(_cred => _cred.issueeName) ?? [];
+ const _credentials =
+ data?.credentials?.filter((_cred) => _cred.issueeName) ?? [];
setCredentials(_credentials);
}
};
@@ -83,7 +84,9 @@ export function SelectCredential(): JSX.Element {
- {formatMessage({ id: "credential.unidentifiedIssuee" })}
+
+ {formatMessage({ id: "credential.unidentifiedIssuee" })}
+
>
@@ -92,6 +95,13 @@ export function SelectCredential(): JSX.Element {
))}
+ {!isLoading && !credentials?.length ? (
+
+ {formatMessage({ id: "message.noItems" })}
+
+ ) : (
+ <>>
+ )}
>
);
}
diff --git a/src/pages/background/index.ts b/src/pages/background/index.ts
index 98209fe..9f9d50e 100644
--- a/src/pages/background/index.ts
+++ b/src/pages/background/index.ts
@@ -1,5 +1,6 @@
import browser from "webextension-polyfill";
import { configService } from "@pages/background/services/config";
+import { sessionStorageService } from "@pages/background/services/browser-storage";
import { IMessage } from "@config/types";
import { senderIsPopup } from "@pages/background/utils";
import { setActionIcon } from "@shared/browser/action-utils";
@@ -13,7 +14,7 @@ const SAVE_TIMESTAMP_INTERVAL_MS = 2 * 1000;
function saveTimestamp() {
const timestamp = new Date().toISOString();
- browser.storage.session.set({ timestamp });
+ sessionStorageService.setValue("timestamp", timestamp);
}
browser.runtime.onStartup.addListener(function () {
@@ -33,7 +34,6 @@ browser.runtime.onInstalled.addListener(function (object) {
}
});
-
// Listener to handle internal messages from content scripts from active tab and popup
browser.runtime.onMessage.addListener(function (
message: IMessage,
@@ -97,4 +97,4 @@ async function initBackground() {
saveTimestamp();
setInterval(saveTimestamp, SAVE_TIMESTAMP_INTERVAL_MS);
}
-initBackground();
\ No newline at end of file
+initBackground();
diff --git a/src/pages/background/services/browser-storage.ts b/src/pages/background/services/browser-storage.ts
index d176759..6a4a0d6 100644
--- a/src/pages/background/services/browser-storage.ts
+++ b/src/pages/background/services/browser-storage.ts
@@ -1,4 +1,4 @@
-import browser from "webextension-polyfill";
+import browser, { Storage } from "webextension-polyfill";
export const getSyncStorage = () => {
return browser.storage.sync;
@@ -8,7 +8,11 @@ export const getNonSyncStorage = () => {
return browser.storage.local;
};
-const BrowserStorage = (storage = getNonSyncStorage()) => {
+export const getSessionStorage = () => {
+ return browser.storage.session;
+};
+
+const BrowserStorage = (storage: Storage.StorageArea) => {
const _storage = storage;
const getAllKeys = async () => {
@@ -43,4 +47,5 @@ const BrowserStorage = (storage = getNonSyncStorage()) => {
};
};
-export const browserStorageService = BrowserStorage();
+export const browserStorageService = BrowserStorage(getNonSyncStorage());
+export const sessionStorageService = BrowserStorage(getSessionStorage());
diff --git a/src/pages/background/services/user.ts b/src/pages/background/services/user.ts
index f91152d..bc5fe99 100644
--- a/src/pages/background/services/user.ts
+++ b/src/pages/background/services/user.ts
@@ -1,4 +1,4 @@
-import { browserStorageService } from "@pages/background/services/browser-storage";
+import { sessionStorageService } from "@pages/background/services/browser-storage";
const USER_ENUMS = {
PASSCODE: "user-passcode",
@@ -7,31 +7,31 @@ const USER_ENUMS = {
const User = () => {
const getPasscode = async (): Promise => {
- return (await browserStorageService.getValue(
+ return (await sessionStorageService.getValue(
USER_ENUMS.PASSCODE
)) as string;
};
const removePasscode = async () => {
- await browserStorageService.removeKey(USER_ENUMS.PASSCODE);
+ await sessionStorageService.removeKey(USER_ENUMS.PASSCODE);
};
const setPasscode = async (passcode: string) => {
- await browserStorageService.setValue(USER_ENUMS.PASSCODE, passcode);
+ await sessionStorageService.setValue(USER_ENUMS.PASSCODE, passcode);
};
const getControllerId = async (): Promise => {
- return (await browserStorageService.getValue(
+ return (await sessionStorageService.getValue(
USER_ENUMS.CONTROLLER_ID
)) as string;
};
const removeControllerId = async () => {
- await browserStorageService.removeKey(USER_ENUMS.CONTROLLER_ID);
+ await sessionStorageService.removeKey(USER_ENUMS.CONTROLLER_ID);
};
const setControllerId = async (controllerId: string) => {
- await browserStorageService.setValue(
+ await sessionStorageService.setValue(
USER_ENUMS.CONTROLLER_ID,
controllerId
);