Skip to content

Commit

Permalink
fix: Fix for PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanTkachev committed May 27, 2021
1 parent 25ff5c8 commit 967d443
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/common/FormCheckbox.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useField } from 'formik';
import React from 'react';
import Error from './Error';
import { Box, Checkbox, Flex, Label } from '@theme-ui/components';
import { Box, Flex, Label } from '@theme-ui/components';
import { Switch } from '@tabetalt/kit';

export const FormCheckbox: React.FC<any> = ({ label, ...props }: any) => {
Expand Down
5 changes: 1 addition & 4 deletions src/context/TenantContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ export type TenantItem = GetTenantsQuery['tenants']['items'][0];
interface TenantContextValue {
tenants: TenantItem[];
currentTenant: TenantItem | null;
updateRequired: () => void;
updateRequired?: () => void;
}

export const TenantContext = React.createContext<TenantContextValue>({
tenants: [],
currentTenant: null,
updateRequired: () => {
// Dummy function
},
} as TenantContextValue);

export function useTenant(): TenantContextValue {
Expand Down
7 changes: 2 additions & 5 deletions src/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,8 @@ export const formatPrice = (
return amount;
};

export const formatMoney = (value?: Money | null): string => {
if (!value) return '0';

const amount = value as DineroObject ? Dinero(priceValue).toFormat('0.00') : '0';
return amount;
export const formatMoney = (value?: Money): string => {
return value ? Dinero(value as DineroObject).toFormat('0.00') : '0';
};

export const valueFromString = (
Expand Down
4 changes: 2 additions & 2 deletions src/modules/settings/GeneralSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const GeneralSettings: React.FC<GeneralSettingsProps> = ({ tenant }) => {
const onSubmitGeneral = useCallback(
async (input) => {
await updateTenant({ variables: { id: tenant?.id || 1, input } });
updateRequired();
if (updateRequired) updateRequired();
},
[updateTenant]
);
Expand Down Expand Up @@ -105,7 +105,7 @@ export const GeneralSettings: React.FC<GeneralSettingsProps> = ({ tenant }) => {
linkedin: findSocialMediaByName(SocialMediaType.Linkedin) || '',
}}
validationSchema={TenantSchema}
onSubmit={async (values, { setSubmitting }) => {
onSubmit={async (values) => {
const input: TenantUpdateInput = {
priceDisplay: values.priceDisplay,
title: values.title,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/settings/ShippingSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const Shipping: React.FC<ShippingSettingsProps> = ({ tenant }) => {
const [openModal, setOpenModal] = useState(false);
const [currentDeliveryMethod, setCurrentDeliveryMethod] =
useState<DeliveryMethodItem | null>(null);
const { data, loading, error } = useGetDeliveryMethodsQuery();
const { data } = useGetDeliveryMethodsQuery();
const [deleteDeliveryMethod, { loading: deleteLoading }] =
useDeleteDeliveryMethodMutation({
refetchQueries: [{ query: GetDeliveryMethodsDocument }],
Expand Down

0 comments on commit 967d443

Please sign in to comment.