Provisioning: Retain old token in config (#100597)

fix: retain old token in config
This commit is contained in:
Mariell Hoversholm
2025-02-13 14:13:48 +01:00
committed by GitHub
parent 45a586c725
commit 45ebb0b1f9
@@ -94,8 +94,13 @@ export function ConfigForm({ data }: ConfigFormProps) {
}
}, [request.isSuccess, reset, getValues, navigate]);
const onSubmit = (data: RepositoryFormData) => {
const spec = dataToSpec(data);
const onSubmit = (form: RepositoryFormData) => {
const spec = dataToSpec(form);
if (spec.github) {
spec.github.token = form.token || data?.spec?.github?.token;
// If we're still keeping this as GitHub, persist the old token. If we set a new one, it'll be re-encrypted into here.
spec.github.encryptedToken = data?.spec?.github?.encryptedToken;
}
submitData(spec);
};