fix: Secrets build/runtime coudl be changed after save

This commit is contained in:
Andras Bacsai
2022-04-04 13:49:26 +02:00
parent 305fab488e
commit b023d65fcf
4 changed files with 72 additions and 20 deletions

View File

@@ -10,7 +10,6 @@ type Props = {
isPRMRSecret?: boolean;
isNewSecret?: boolean;
applicationId: string;
dispatch: (name: string) => void;
};
export async function saveSecret({
@@ -20,8 +19,7 @@ export async function saveSecret({
isBuildSecret,
isPRMRSecret,
isNewSecret,
applicationId,
dispatch
applicationId
}: Props): Promise<void> {
if (!name) return errorNotification('Name is required.');
if (!value) return errorNotification('Value is required.');
@@ -33,13 +31,11 @@ export async function saveSecret({
isPRMRSecret,
isNew: isNew || false
});
dispatch('refresh');
if (isNewSecret) {
name = '';
value = '';
isBuildSecret = false;
}
toast.push('Secret saved.');
} catch ({ error }) {
return errorNotification(error);
}