mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 14:27:23 +00:00
fix(lint): fix type errors
This commit is contained in:
@@ -43,32 +43,31 @@ export const useGetActiveSharedSecretById = ({
|
||||
sharedSecretId: string;
|
||||
hashedHex: string;
|
||||
}) => {
|
||||
return useQuery<TViewSharedSecretResponse, [string]>({
|
||||
enabled: Boolean(sharedSecretId) && Boolean(hashedHex),
|
||||
queryFn: async () => {
|
||||
const params = new URLSearchParams({
|
||||
hashedHex
|
||||
});
|
||||
|
||||
return useQuery<TViewSharedSecretResponse | null>(
|
||||
[`sharedSecret-${sharedSecretId}`],
|
||||
async () => {
|
||||
const params = new URLSearchParams({ hashedHex });
|
||||
const { data } = await apiRequest.get<TViewSharedSecretResponse>(
|
||||
`/api/v1/secret-sharing/public/${sharedSecretId}`,
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
|
||||
if (!data) return null;
|
||||
|
||||
|
||||
if (!data) return null
|
||||
|
||||
return {
|
||||
encryptedValue: data.encryptedValue,
|
||||
password: data.password,
|
||||
iv: data.iv,
|
||||
tag: data.tag,
|
||||
accessType: data.accessType,
|
||||
orgName: data.orgName
|
||||
};
|
||||
},
|
||||
{
|
||||
enabled: Boolean(sharedSecretId) && Boolean(hashedHex)
|
||||
}
|
||||
});
|
||||
);
|
||||
};
|
||||
|
||||
// returns a secret (secret or undefined if password doesn't match)
|
||||
|
||||
@@ -10,8 +10,7 @@ import { TViewSharedSecretResponse, useGetActiveSharedSecretById } from "@app/ho
|
||||
import { SecretContainer, SecretErrorContainer, PasswordContainer } from "./components";
|
||||
|
||||
export const ViewSecretPublicPage = () => {
|
||||
const [secret, setSecret] = useState(null)
|
||||
const [error, setError] = useState(null)
|
||||
const [secret, setSecret] = useState<TViewSharedSecretResponse | null>(null);
|
||||
const router = useRouter();
|
||||
const { id, key: urlEncodedPublicKey } = router.query;
|
||||
|
||||
@@ -19,15 +18,14 @@ export const ViewSecretPublicPage = () => {
|
||||
? urlEncodedPublicKey.toString().split("-")
|
||||
: ["", ""];
|
||||
|
||||
const { data: fetchSecret, error: fetchError, isLoading } = useGetActiveSharedSecretById({
|
||||
const { data: fetchSecret, error, isLoading } = useGetActiveSharedSecretById({
|
||||
sharedSecretId: id as string,
|
||||
hashedHex
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (fetchSecret) setSecret(fetchSecret)
|
||||
if (fetchError) setError(fetchError)
|
||||
}, [fetchSecret, fetchError])
|
||||
}, [fetchSecret, error])
|
||||
|
||||
const handleSecret = useCallback((value: TViewSharedSecretResponse) => {
|
||||
setSecret(value)
|
||||
|
||||
Reference in New Issue
Block a user