mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-15 21:40:31 +00:00
fix: envkey upload timeout
This commit is contained in:
@@ -8,20 +8,27 @@ export const useImportEnvKey = () => {
|
||||
const queryClient = useQueryClient();
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async ({
|
||||
encryptedJson,
|
||||
decryptionKey
|
||||
}: {
|
||||
encryptedJson: {
|
||||
nonce: string;
|
||||
data: string;
|
||||
};
|
||||
decryptionKey: string;
|
||||
}) => {
|
||||
await apiRequest.post("/api/v3/migrate/env-key/", {
|
||||
encryptedJson,
|
||||
decryptionKey
|
||||
});
|
||||
mutationFn: async ({ file, decryptionKey }: { file: File; decryptionKey: string }) => {
|
||||
const formData = new FormData();
|
||||
|
||||
formData.append("decryptionKey", decryptionKey);
|
||||
formData.append("file", file);
|
||||
|
||||
try {
|
||||
const response = await apiRequest.post("/api/v3/migrate/env-key/", formData, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data"
|
||||
},
|
||||
onUploadProgress: (progressEvent) => {
|
||||
const percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
|
||||
console.log(`Upload Progress: ${percentCompleted}%`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log("Upload successful:", response.data);
|
||||
} catch (error) {
|
||||
console.error("Upload failed:", error);
|
||||
}
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace);
|
||||
|
||||
Reference in New Issue
Block a user