Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default value set to false for boolean attributes #1772

Merged
merged 2 commits into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ function setAttributeFormData(hash) {
const type = formType === 'number' ? 'integer' : formType;
let defaultValue = type === 'number' ? 0 : '';

if (type === 'checkbox') {
if (type === 'boolean') {
defaultValue = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export function* submitChanges(action) {
try {
// Show button loader
yield put(setButtonLoader());

const modelName = get(storeData.getContentType(), 'name');
const data = yield select(makeSelectModel());
const body = cloneDeep(data);
Expand All @@ -83,7 +82,7 @@ export function* submitChanges(action) {
set(body.attributes[index].params, 'plugin', true);
}

if (!value && key !== 'multiple') {
if (!value && key !== 'multiple' && key !== 'default') {
const paramsKey = includes(key, 'Value') ? replace(key,'Value', '') : key;
unset(body.attributes[index].params, paramsKey);
}
Expand All @@ -99,7 +98,6 @@ export function* submitChanges(action) {
const baseUrl = '/content-type-builder/models/';
const requestUrl = method === 'POST' ? baseUrl : `${baseUrl}${body.name}`;
const opts = { method, body };

const response = yield call(request, requestUrl, opts, true);

if (response.ok) {
Expand Down