mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-17 04:09:51 +02:00
Preserve Cloudinary configuration on settings update
Modify Cloudinary configuration endpoint to allow partial updates and preserve existing API keys and secrets when not explicitly provided, and clear input fields on successful save. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ae4037a0-2a6f-4530-9bac-79b543286bda Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/397bca8c-984f-43ff-841a-10897aeb8140/ae4037a0-2a6f-4530-9bac-79b543286bda/sEXz3DF
This commit is contained in:
1 parent
d57bc0fb81
commit
3adfbb57bd
3 files changed
+42
-12
No files matched your search
@@ -55,18 +55,28 @@ export default function Settings() {
|
||||
const hasExistingConfig = !!openrouterConfig;
|
||||
|
||||
const saveCloudinaryMutation = useMutation({
|
||||
mutationFn: () =>
|
||||
apiRequest('POST', '/api/cloudinary/config', {
|
||||
mutationFn: () => {
|
||||
const payload: any = {
|
||||
cloudName,
|
||||
apiKey,
|
||||
apiSecret,
|
||||
}),
|
||||
};
|
||||
|
||||
// N'inclure apiKey et apiSecret que s'ils ne sont pas vides
|
||||
if (apiKey && apiKey.trim() !== "") {
|
||||
payload.apiKey = apiKey;
|
||||
}
|
||||
if (apiSecret && apiSecret.trim() !== "") {
|
||||
payload.apiSecret = apiSecret;
|
||||
}
|
||||
|
||||
return apiRequest('POST', '/api/cloudinary/config', payload);
|
||||
},
|
||||
onSuccess: () => {
|
||||
queryClient.invalidateQueries({ queryKey: ['/api/cloudinary/config'] });
|
||||
toast({
|
||||
title: "Configuration sauvegardée",
|
||||
description: "Vos paramètres Cloudinary ont été enregistrés",
|
||||
});
|
||||
setApiKey(""); // Clear the API key after saving
|
||||
setApiSecret(""); // Clear the secret after saving
|
||||
},
|
||||
onError: () => {
|
||||
|
||||
Reference in new issue
Block a user