fix: requested changes

This commit is contained in:
Daniel Hougaard
2024-10-01 00:16:18 +04:00
parent 9c33251c44
commit b65842f5c1
8 changed files with 28 additions and 63 deletions
@@ -15,14 +15,6 @@ const extractDetailsFromUrl = (router: NextRouter) => {
const idString = id as string;
if (!idString) {
return {
id: "",
hashedHex: "",
key: null
};
}
if (urlEncodedKey) {
const [hashedHex, key] = urlEncodedKey ? urlEncodedKey.toString().split("-") : ["", ""];
@@ -33,13 +25,9 @@ const extractDetailsFromUrl = (router: NextRouter) => {
};
}
// get the first 36 characters as id and the rest as hex
const idPart = idString.substring(0, 36);
const hexPart = idString.substring(36);
return {
id: idPart || "",
hashedHex: hexPart || "",
id: idString,
hashedHex: null,
key: null
};
};
@@ -65,6 +53,9 @@ export const ViewSecretPublicPage = () => {
((error as AxiosError)?.response?.data as { message: string })?.message ===
"Invalid credentials";
console.log("data", fetchSecret);
console.log("err", error);
const shouldShowPasswordPrompt =
isInvalidCredential || (fetchSecret?.isPasswordProtected && !fetchSecret.secret);
const isValidatingPassword = Boolean(password) && isFetching;