replace some lodash function with native

This commit is contained in:
Jimmy Wärting 2022-11-24 17:52:25 +01:00
parent 00a3f69152
commit 7431f353e9
4 changed files with 5 additions and 8 deletions

View File

@ -12,7 +12,6 @@ import {
} from '@strapi/helper-plugin';
import { Main } from '@strapi/design-system/Main';
import { Formik } from 'formik';
import { get } from 'lodash';
import { useRouteMatch, useHistory } from 'react-router-dom';
import { useQuery } from 'react-query';
import { formatAPIErrors } from '../../../../../utils';
@ -205,12 +204,12 @@ const ApiTokenCreateView = () => {
if (err?.response?.data?.error?.message === MSG_ERROR_NAME_TAKEN) {
toggleNotification({
type: 'warning',
message: get(err, 'response.data.message', 'notification.error.tokennamenotunique'),
message: err.response.data.message || 'notification.error.tokennamenotunique',
});
} else {
toggleNotification({
type: 'warning',
message: get(err, 'response.data.message', 'notification.error'),
message: err?.response?.data?.message || 'notification.error',
});
}
unlockApp();

View File

@ -63,7 +63,7 @@ const SettingsPage = () => {
setConfig(config);
const testAddressFound = get(config, 'settings.testAddress');
const testAddressFound = config?.settings?.testAddress;
if (testAddressFound) {
setTestAddress(testAddressFound);

View File

@ -1,9 +1,7 @@
'use strict';
const _ = require('lodash');
const createProvider = (emailConfig) => {
const providerName = _.toLower(emailConfig.provider);
const providerName = emailConfig.provider.toLowerCase();
let provider;
let modulePath;

View File

@ -29,7 +29,7 @@ module.exports = {
async test(ctx) {
const { to } = ctx.request.body;
if (isNil(to)) {
if (!to) {
throw new ApplicationError('No recipient(s) are given');
}