Skip to content

Commit

Permalink
fix(storefront): 🐛 fixed minor url redirect issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sahrohit committed Sep 9, 2023
1 parent 5d33014 commit bf40165
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 18 deletions.
4 changes: 3 additions & 1 deletion apps/api/src/resolvers/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,9 @@ export class UserResolver {
await sendEmail(
options.email,
"Verify Email",
verifyEmailTemplate(`/auth/verify-email/${token}`)
verifyEmailTemplate(
`${process.env.CLIENT_URL}/auth/verify-email/${token}`
)
);

return { user };
Expand Down
12 changes: 2 additions & 10 deletions apps/storefront/src/components/pages/account/order/OrderCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
} from "@/generated/graphql";
import {
OrderInfo,
PaymentProviderLogo,
colorFromStatus,
orderPageTextFromStatus,
} from "@/pages/order/[id]";
Expand All @@ -41,20 +42,11 @@ import { capitalize } from "@/utils/helpers";
import ConfirmationModal from "@/components/helpers/ConfirmationModal";
import ModalButton from "@/components/ui/ModalButton";
import DividerWithText from "@/components/ui/DividerWithText";
import { EsewaLogoFull } from "@/config/brands";
import LargeButtonRadioGroup from "@/components/ui/radio/large/LargeButtonRadioGroup";
import {
KHALTI_LOGO,
paymentOptions,
} from "../../cart/checkout/PaymentSelector";
import { paymentOptions } from "../../cart/checkout/PaymentSelector";
import { CreateReviewButton } from "../../product/review/ProductReview";
import EmailInvoice from "./EmailInvoice";

const PaymentProviderLogo = {
khalti: <KHALTI_LOGO />,
esewa: <EsewaLogoFull />,
};

interface OrderCardProps {
orderItem: OrderDetail;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export const CreateReviewButton = ({ productId, ...rest }: ReviewFormProps) => {

if (loading || userLoading) {
return (
<Button colorScheme="primary" px={12} size="xl" isLoading>
<Button colorScheme="gray" px={12} size="xl" isLoading {...rest}>
Write a review
</Button>
);
Expand Down
2 changes: 1 addition & 1 deletion apps/storefront/src/pages/auth/register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const RegisterPage = () => (
>
Already have an account?{" "}
<UnderlineLink href="/auth/login">
Log in with Chakra
Log in with Hamropasal
</UnderlineLink>
</Text>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions apps/storefront/src/pages/cart/checkout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ const CheckoutPage = () => {
tAmt: createPayment.createPayment.tAmt,
pid: createPayment.createPayment.pid,
scd: createPayment.createPayment.scd,
su: `http://localhost:3000/cart/checkout/result`,
fu: `http://localhost:3000/cart/checkout/result`,
su: `${process.env.CLIENT_URL}/cart/checkout/result`,
fu: `${process.env.CLIENT_URL}/cart/checkout/result`,
};

const form = document.createElement("form");
Expand Down
13 changes: 10 additions & 3 deletions apps/storefront/src/pages/order/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ import { PriceTag } from "@/components/shared/product/PriceTag";
import { capitalize } from "@/utils/helpers";
import UnderlineLink from "@/components/ui/UnderlineLink";
import PageLoader from "@/components/shared/PageLoader";
import { KHALTI_LOGO } from "@/components/pages/cart/checkout/PaymentSelector";
import TrackingTimeline from "@/components/pages/account/order/TrackingTimelines";
import { EsewaLogoFull, KhaltiLogoFull } from "@/config/brands";
import { BRAND_NAME } from "../../../constants";

export const PaymentProviderLogo = {
khalti: <KhaltiLogoFull />,
esewa: <EsewaLogoFull />,
};

const OrderPage = () => {
const router = useRouter();
const { data: me, loading: userLoading, error: userError } = useMeQuery();
Expand Down Expand Up @@ -167,8 +172,10 @@ const OrderPage = () => {
</OrderInfo>
<OrderInfo label="Payment">
<Text>
{successPayment?.provider?.toUpperCase() === "KHALTI" ? (
<KHALTI_LOGO />
{successPayment?.provider ? (
PaymentProviderLogo[
successPayment.provider as keyof typeof PaymentProviderLogo
]
) : (
<Badge colorScheme={successPayment ? "green" : "red"}>
{successPayment?.provider?.toUpperCase() ?? "UNPAID"}
Expand Down

0 comments on commit bf40165

Please sign in to comment.