mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 22:46:24 +00:00
refactor: convert usequery hook to normal fetch fn (no need for caching)
This commit is contained in:
@@ -68,29 +68,18 @@ export const useGetActiveSharedSecretById = ({
|
||||
});
|
||||
};
|
||||
|
||||
export const useValidateSecretPassword = ({
|
||||
sharedSecretId,
|
||||
hashedHex,
|
||||
userPassword,
|
||||
}: {
|
||||
sharedSecretId: string;
|
||||
hashedHex: string;
|
||||
userPassword: string;
|
||||
}) => {
|
||||
return useQuery(
|
||||
[`validateSecretPass-${sharedSecretId}`],
|
||||
async () => {
|
||||
const { data } = await apiRequest.post<ValidateSecretPassword>(
|
||||
`/api/v1/secret-sharing/public/${sharedSecretId}/validate`,
|
||||
{
|
||||
hashedHex,
|
||||
password: userPassword
|
||||
}
|
||||
);
|
||||
return data;
|
||||
},
|
||||
export const fetchIsSecretPasswordValid = async (
|
||||
sharedSecretId: string,
|
||||
hashedHex: string,
|
||||
password: string,
|
||||
) => {
|
||||
const { data } = await apiRequest.post<ValidateSecretPassword>(
|
||||
`/api/v1/secret-sharing/public/${sharedSecretId}/validate`,
|
||||
{
|
||||
enabled: Boolean(sharedSecretId) && Boolean(userPassword),
|
||||
hashedHex,
|
||||
password
|
||||
}
|
||||
)
|
||||
}
|
||||
);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user