Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
render() {
const { componentClass, ...props } = this.props;
const buttonProps = omit(props, ['url', 'api', 'onSuccess']);
return (
);
}
}
render() {
const { componentClass, ...props } = this.props;
const buttonProps = omit(props, ['url', 'api', 'onSuccess']);
return (
);
}
}
getUserFields(req) {
const params = req.allParams();
// console.log({ params });
if (params.login) {
if (!params.username) {
params.username = params.login;
}
if (!params.email && validateEmail(params.login)) {
params.email = params.login;
} // if email
}
if (params.username) params.username = canonizeUsername(params.username);
if (params.email) params.email = canonize(params.email);
// console.log({ params });
return params;
}
controller.getUserFields = function (req) {
const params = req.allParams();
// console.log({ params });
if (params.login) {
if (!params.username) {
params.username = params.login;
}
if (!params.email && validateEmail(params.login)) {
params.email = params.login;
} // if email
}
if (params.username) params.username = canonizeUsername(params.username);
if (params.email) params.email = canonize(params.email);
// console.log({ params });
return params;
};
controller.getUserCriteria = function (req) {
async find({ skip, limit, __cancelToken } = {}) {
if (!this.api) throw '!api';
if (!this.api.find) throw '!api.find';
let params = getFindParams(this);
if (this.getFindParams) params = this.getFindParams(this, params);
const raw = await this.api.find({
count: 1,
...omitEmpty(params),
limit,
skip,
__cancelToken,
});
let items;
let count;
if (Array.isArray(raw)) {
// console.warn('pack lost, raw != {data}');
items = raw;
count = raw.count >= 0 ? raw.count : null;
} else {
items = raw.data || raw.items || [];
count = raw.count >= 0 ? raw.count : null;
}
isOpen={this.state.visible}
onRequestClose={closable && this.close}
bodyOpenClassName={bodyModalStyle}
htmlOpenClassName={bodyModalStyle}
style={merge(style, Modal2.defaultStyles)}
{...pick(props, reactModalProps)}
>
<span style="{{">{this.state.counter}</span>
<div aria-hidden="">
{/* */}
{/* */}
</div>
{trigger}
);
} : noop}
isOpen={this.state.visible}
onRequestClose={closable && this.close}
bodyOpenClassName={bodyModalStyle}
htmlOpenClassName={bodyModalStyle}
style={merge(style, Modal2.defaultStyles)}
{...pick(props, reactModalProps)}
>
<span style="{{">{this.state.counter}</span>
<div aria-hidden="">
{/* */}
{/* */}
</div>
{trigger}
}
} : noop}
isOpen={this.state.visible}
onRequestClose={closable && this.close}
bodyOpenClassName={bodyModalStyle}
htmlOpenClassName={bodyModalStyle}
style={merge(style, Modal2.defaultStyles)}
{...pick(props, reactModalProps)}
>
<span style="{{">{this.state.counter}</span>
<div aria-hidden="">
{/* */}
{/* */}
</div>
{trigger}
handleClick(e) {
const { onClick, target, to, href, qs } = this.props;
const { linkProvider, history } = this.context;
if (isMiddleClickEvent(e)) {
return;
}
if (onClick) onClick(e);
if (e.defaultPrevented === true) return;
if (isModifiedEvent(e) || !isLeftClickEvent(e)) return;
const url = composeUrl({ url: to || href, qs });
if (url == null) return;
if (target === '_blank' || isAbsoluteUrl(url)) return;
e.preventDefault();
if (history) {
history.push(url);
} else if (linkProvider) {
linkProvider.onClick(url, e);
} else {
console.error('Link without linkProvider (history)'); // eslint-disable-line no-console
window.location = url;
}
}
locales.forEach((locale) => {
const dirname = path.join(destination, locale);
try {
mkdirp.sync(dirname);
} catch (err) {
console.error(err);
}
fs.writeFileSync(`${dirname}.json`, JSON.stringify(getKeyValJson(localesRows, locale), null, 2)); // eslint-disable-line max-len
// fs.writeFileSync(`${dirname}/translation.json`, JSON.stringify(getKeyValJson(localesRows, locale), null, 2)); // eslint-disable-line max-len
const namespaces = groupBy(localesRows, 'ns');
forEach(namespaces, (rows, ns) => {
if (!ns) return;
fs.writeFileSync(`${dirname}/${ns}.json`, JSON.stringify(getKeyValJson(rows, locale), null, 2));
});
});
};