Skip to content

Commit

Permalink
Merge pull request #1772 from strapi/fix-1704
Browse files Browse the repository at this point in the history
Fix default value set to false for boolean attributes
  • Loading branch information
lauriejim committed Aug 21, 2018
2 parents 8e39fca + ff886cc commit 25536c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
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

0 comments on commit 25536c8

Please sign in to comment.