prettier fix
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
import Isikukood from 'isikukood';
|
||||
import parsePhoneNumber from 'libphonenumber-js/min';
|
||||
import { z } from 'zod';
|
||||
|
||||
const updateAccountSchema = {
|
||||
firstName: z
|
||||
@@ -39,14 +39,18 @@ const updateAccountSchema = {
|
||||
(phone) => {
|
||||
try {
|
||||
const phoneNumber = parsePhoneNumber(phone);
|
||||
return !!phoneNumber && phoneNumber.isValid() && phoneNumber.country === 'EE';
|
||||
return (
|
||||
!!phoneNumber &&
|
||||
phoneNumber.isValid() &&
|
||||
phoneNumber.country === 'EE'
|
||||
);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
{
|
||||
message: 'common:formFieldError.invalidPhoneNumber',
|
||||
}
|
||||
},
|
||||
),
|
||||
city: z.string().optional(),
|
||||
weight: z
|
||||
@@ -81,22 +85,27 @@ export const UpdateAccountSchemaServer = z.object({
|
||||
height: updateAccountSchema.height.nullable(),
|
||||
userConsent: updateAccountSchema.userConsent,
|
||||
});
|
||||
export const UpdateAccountSchemaClient = ({ isEmailUser }: { isEmailUser: boolean }) => z.object({
|
||||
firstName: updateAccountSchema.firstName,
|
||||
lastName: updateAccountSchema.lastName,
|
||||
personalCode: updateAccountSchema.personalCode,
|
||||
email: updateAccountSchema.email,
|
||||
phone: updateAccountSchema.phone,
|
||||
...(isEmailUser
|
||||
? {
|
||||
city: z.string().optional(),
|
||||
weight: z.number().optional(),
|
||||
height: z.number().optional(),
|
||||
}
|
||||
: {
|
||||
city: updateAccountSchema.city,
|
||||
weight: updateAccountSchema.weight,
|
||||
height: updateAccountSchema.height,
|
||||
}),
|
||||
userConsent: updateAccountSchema.userConsent,
|
||||
});
|
||||
export const UpdateAccountSchemaClient = ({
|
||||
isEmailUser,
|
||||
}: {
|
||||
isEmailUser: boolean;
|
||||
}) =>
|
||||
z.object({
|
||||
firstName: updateAccountSchema.firstName,
|
||||
lastName: updateAccountSchema.lastName,
|
||||
personalCode: updateAccountSchema.personalCode,
|
||||
email: updateAccountSchema.email,
|
||||
phone: updateAccountSchema.phone,
|
||||
...(isEmailUser
|
||||
? {
|
||||
city: z.string().optional(),
|
||||
weight: z.number().optional(),
|
||||
height: z.number().optional(),
|
||||
}
|
||||
: {
|
||||
city: updateAccountSchema.city,
|
||||
weight: updateAccountSchema.weight,
|
||||
height: updateAccountSchema.height,
|
||||
}),
|
||||
userConsent: updateAccountSchema.userConsent,
|
||||
});
|
||||
|
||||
@@ -4,9 +4,8 @@ import { updateCustomer } from '@lib/data/customer';
|
||||
|
||||
import { AccountSubmitData, createAuthApi } from '@kit/auth/api';
|
||||
import { enhanceAction } from '@kit/next/actions';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { pathsConfig } from '@kit/shared/config';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { UpdateAccountSchemaServer } from '../schemas/update-account.schema';
|
||||
|
||||
@@ -32,14 +31,14 @@ export const onUpdateAccount = enhanceAction(
|
||||
phone: params.phone,
|
||||
});
|
||||
} catch (e) {
|
||||
console.error("Failed to update Medusa customer", e);
|
||||
console.error('Failed to update Medusa customer', e);
|
||||
}
|
||||
|
||||
const hasUnseenMembershipConfirmation =
|
||||
await api.hasUnseenMembershipConfirmation();
|
||||
return {
|
||||
hasUnseenMembershipConfirmation,
|
||||
}
|
||||
};
|
||||
},
|
||||
{
|
||||
schema: UpdateAccountSchemaServer,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { withI18n } from '~/lib/i18n/with-i18n';
|
||||
|
||||
|
||||
async function SiteLayout(props: React.PropsWithChildren) {
|
||||
return (
|
||||
<div className={'flex min-h-[100vh] flex-col items-center justify-center'}>
|
||||
|
||||
Reference in New Issue
Block a user