feat: fixed UI and added permissions check to backend

This commit is contained in:
Daniel Hougaard
2024-10-01 05:17:46 +04:00
parent 0485b56e8d
commit f0210c2607
7 changed files with 460 additions and 232 deletions
+23 -19
View File
@@ -5,23 +5,27 @@ import { apiRequest } from "@app/config/request";
import { workspaceKeys } from "../workspace";
export const useImportEnvKey = () => {
const queryClient = useQueryClient();
const queryClient = useQueryClient();
return useMutation({
mutationFn: async ({ encryptedJson, decryptionKey }: {
encryptedJson: {
nonce: string,
data: string
}, decryptionKey: string
}): Promise<{ success: boolean, message: string }> => {
const { data } = await apiRequest.post("/api/v3/migrate/env-key/", {
encryptedJson,
decryptionKey
});
return data;
},
onSuccess: () => {
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace);
}
});
};
return useMutation({
mutationFn: async ({
encryptedJson,
decryptionKey
}: {
encryptedJson: {
nonce: string;
data: string;
};
decryptionKey: string;
}) => {
const { data } = await apiRequest.post("/api/v3/migrate/env-key/", {
encryptedJson,
decryptionKey
});
return data;
},
onSuccess: () => {
queryClient.invalidateQueries(workspaceKeys.getAllUserWorkspace);
}
});
};