mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 05:19:49 +00:00
fix: requested changes
This commit is contained in:
@@ -8,7 +8,7 @@ export const secretSharingKeys = {
|
||||
allSharedSecrets: () => ["sharedSecrets"] as const,
|
||||
specificSharedSecrets: ({ offset, limit }: { offset: number; limit: number }) =>
|
||||
[...secretSharingKeys.allSharedSecrets(), { offset, limit }] as const,
|
||||
getSecretById: (arg: { id: string; hashedHex: string; password?: string }) => [
|
||||
getSecretById: (arg: { id: string; hashedHex: string | null; password?: string }) => [
|
||||
"shared-secret",
|
||||
arg
|
||||
]
|
||||
@@ -46,7 +46,7 @@ export const useGetActiveSharedSecretById = ({
|
||||
password
|
||||
}: {
|
||||
sharedSecretId: string;
|
||||
hashedHex: string;
|
||||
hashedHex: string | null;
|
||||
password?: string;
|
||||
}) => {
|
||||
return useQuery<TViewSharedSecretResponse>(
|
||||
@@ -55,7 +55,7 @@ export const useGetActiveSharedSecretById = ({
|
||||
const { data } = await apiRequest.post<TViewSharedSecretResponse>(
|
||||
`/api/v1/secret-sharing/public/${sharedSecretId}`,
|
||||
{
|
||||
hashedHex,
|
||||
...(hashedHex && { hashedHex }),
|
||||
password
|
||||
}
|
||||
);
|
||||
@@ -63,7 +63,7 @@ export const useGetActiveSharedSecretById = ({
|
||||
return data;
|
||||
},
|
||||
{
|
||||
enabled: Boolean(sharedSecretId) && Boolean(hashedHex)
|
||||
enabled: Boolean(sharedSecretId)
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user