diff --git a/app/account/component/AccountBook.tsx b/app/account/component/accont-book.tsx similarity index 100% rename from app/account/component/AccountBook.tsx rename to app/account/component/accont-book.tsx diff --git a/app/account/component/AuthLayout.tsx b/app/account/component/auth-layout.tsx similarity index 100% rename from app/account/component/AuthLayout.tsx rename to app/account/component/auth-layout.tsx diff --git a/app/account/component/FormButton.tsx b/app/account/component/form-button.tsx similarity index 100% rename from app/account/component/FormButton.tsx rename to app/account/component/form-button.tsx diff --git a/app/account/component/FormFooter.tsx b/app/account/component/form-footer.tsx similarity index 100% rename from app/account/component/FormFooter.tsx rename to app/account/component/form-footer.tsx diff --git a/app/account/component/FormHeader.tsx b/app/account/component/form-header.tsx similarity index 100% rename from app/account/component/FormHeader.tsx rename to app/account/component/form-header.tsx diff --git a/app/account/component/OrderHistory.tsx b/app/account/component/order-history.tsx similarity index 100% rename from app/account/component/OrderHistory.tsx rename to app/account/component/order-history.tsx diff --git a/app/account/component/SignOutSection.tsx b/app/account/component/sign-out-section.tsx similarity index 100% rename from app/account/component/SignOutSection.tsx rename to app/account/component/sign-out-section.tsx diff --git a/app/account/login/page.tsx b/app/account/login/page.tsx index 85dd7f254..91c27bd33 100644 --- a/app/account/login/page.tsx +++ b/app/account/login/page.tsx @@ -2,10 +2,10 @@ import { loginCustomer } from 'lib/shopify'; import { revalidatePath } from 'next/cache'; import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; -import AuthLayout from '../component/AuthLayout'; -import FormButton from '../component/FormButton'; -import FormFooter from '../component/FormFooter'; -import FormHeader from '../component/FormHeader'; +import AuthLayout from '../component/auth-layout'; +import FormButton from '../component/form-button'; +import FormFooter from '../component/form-footer'; +import FormHeader from '../component/form-header'; let emailError: string | null = null; let passwordError: string | null = null; diff --git a/app/account/page.tsx b/app/account/page.tsx index 58a015079..bfa3d97ca 100644 --- a/app/account/page.tsx +++ b/app/account/page.tsx @@ -1,6 +1,6 @@ import { getCustomer } from 'lib/shopify'; import { cookies } from 'next/headers'; -import SignOutSection from './component/SignOutSection'; +import SignOutSection from './component/sign-out-section'; async function AccountPage({ searchParams }: { searchParams: { [key: string]: string } }) { const token = cookies().get('customerAccessToken')?.value as string; diff --git a/app/account/recover/page.tsx b/app/account/recover/page.tsx index 21b84afb1..fa0c5a43b 100644 --- a/app/account/recover/page.tsx +++ b/app/account/recover/page.tsx @@ -1,9 +1,9 @@ import { recoverCustomersPassword } from 'lib/shopify'; import { revalidatePath } from 'next/cache'; -import AuthLayout from '../component/AuthLayout'; -import FormButton from '../component/FormButton'; -import FormFooter from '../component/FormFooter'; -import FormHeader from '../component/FormHeader'; +import AuthLayout from '../component/auth-layout'; +import FormButton from '../component/form-button'; +import FormFooter from '../component/form-footer'; +import FormHeader from '../component/form-header'; let emailError: string | null = null; let isSubmited: boolean = false; diff --git a/app/account/register/page.tsx b/app/account/register/page.tsx index 7b1b00414..fd45809aa 100644 --- a/app/account/register/page.tsx +++ b/app/account/register/page.tsx @@ -2,10 +2,10 @@ import { createCustomer, loginCustomer } from 'lib/shopify'; import { revalidatePath } from 'next/cache'; import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; -import AuthLayout from '../component/AuthLayout'; -import FormButton from '../component/FormButton'; -import FormFooter from '../component/FormFooter'; -import FormHeader from '../component/FormHeader'; +import AuthLayout from '../component/auth-layout'; +import FormButton from '../component/form-button'; +import FormFooter from '../component/form-footer'; +import FormHeader from '../component/form-header'; let emailError: string | null = null; let passwordError: string | null = null; diff --git a/app/account/reset/[id]/[resetToken]/page.tsx b/app/account/reset/[id]/[resetToken]/page.tsx index b75e15ab4..8666b56dd 100644 --- a/app/account/reset/[id]/[resetToken]/page.tsx +++ b/app/account/reset/[id]/[resetToken]/page.tsx @@ -2,9 +2,9 @@ import { resetCustomersPassword } from 'lib/shopify'; import { revalidatePath } from 'next/cache'; import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; -import AuthLayout from '../../../component/AuthLayout'; -import FormButton from '../../../component/FormButton'; -import FormHeader from '../../../component/FormHeader'; +import AuthLayout from '../../../component/auth-layout'; +import FormButton from '../../../component/form-button'; +import FormHeader from '../../../component/form-header'; let errorMessage: string | null = null; let passwordError: string | null = null; diff --git a/lib/isAuthenticated.ts b/lib/is-authenticated.ts similarity index 54% rename from lib/isAuthenticated.ts rename to lib/is-authenticated.ts index 955aff732..12a959657 100644 --- a/lib/isAuthenticated.ts +++ b/lib/is-authenticated.ts @@ -1,8 +1,8 @@ import { NextRequest } from 'next/server'; const isAuthenticated = (request: NextRequest) => { - const customerAccessToken = request.cookies.get('customerAccessToken')?.value; - return customerAccessToken; + const customerAccessToken = request.cookies.get('customerAccessToken')?.value; + return customerAccessToken; }; export default isAuthenticated; diff --git a/lib/shopify/types.ts b/lib/shopify/types.ts index 1db022284..32dab36f5 100644 --- a/lib/shopify/types.ts +++ b/lib/shopify/types.ts @@ -353,6 +353,7 @@ export type UserError = DisplayableError & { message: Scalars['String']; }; +/** Return type for `customerAccessToken` mutation. */ export type CustomerAccessTokenCreatePayload = { __typename?: 'CustomerAccessTokenCreatePayload'; /** The newly created customer access token object. */ @@ -371,6 +372,7 @@ export type CustomerCreatePayload = { __typename?: 'CustomerCreatePayload'; /** The created customer object. */ customer?: Maybe; + customerUserErrors: Array; /** The list of errors that occurred from executing the mutation. */ /** * The list of errors that occurred from executing the mutation. @@ -378,6 +380,7 @@ export type CustomerCreatePayload = { */ }; +/** Return type for `customerRecover` mutation. */ export type CustomerRecoverPayload = { __typename?: 'CustomerRecoverPayload'; /** The list of errors that occurred from executing the mutation. */ @@ -389,6 +392,8 @@ export type CustomerRecoverPayload = { userErrors: Array; }; + +/** Return type for `customerReset` mutation. */ export type CustomerResetPayload = { __typename?: 'CustomerResetPayload'; /** The customer object which was reset. */ diff --git a/middleware.ts b/middleware.ts index f21bb3985..b5cd8bcd7 100644 --- a/middleware.ts +++ b/middleware.ts @@ -1,5 +1,5 @@ import { NextRequest, NextResponse } from 'next/server'; -import isAuthenticated from './lib/isAuthenticated'; +import isAuthenticated from './lib/is-authenticated'; export const config = { matcher: ['/checkout', '/account', '/account/:path*'],