This commit is contained in:
Parsa Nazer
2025-09-23 10:13:12 +03:30
9 changed files with 40 additions and 60 deletions
@@ -224,7 +224,7 @@ watch(
</template>
<NuxtLink
v-else
to="/signin"
:to="{ name: 'signin', query: { cb_url: route.path } }"
class="w-full"
>
<Button
@@ -0,0 +1,23 @@
import useGetCartOrders from "~/composables/api/orders/useGetCartOrders";
import { useToast } from "~/composables/global/useToast";
export default defineNuxtRouteMiddleware(async () => {
const { addToast } = useToast();
const { data: cart, suspense } = useGetCartOrders();
if (!!cart.value) {
if (!!cart.value?.address) {
return;
} else {
addToast({
message: "لطفا آدرس سفارش خود را انتخاب کنید",
options: {
status: "error",
},
});
return navigateTo("/cart/delivery");
}
} else {
await suspense();
}
});
-9
View File
@@ -1,9 +0,0 @@
export default defineNuxtRouteMiddleware(() => {
const config = useRuntimeConfig();
if (config.public.DEBUG === "true") {
return;
} else {
return navigateTo("/");
}
});
-1
View File
@@ -144,7 +144,6 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
API_BASE_URL: process.env.API_BASE_URL,
DEBUG: process.env.DEBUG,
},
},
});
+1 -37
View File
@@ -9,7 +9,7 @@ useSeoMeta({
definePageMeta({
layout: "cart",
middleware: "check-is-logged-in",
middleware: ["check-is-logged-in", "check-has-selected-address"],
prevPage: { name: "cart-delivery", label: "انتخاب آدرس" },
nextPage: { name: "payment", label: "پرداخت" },
});
@@ -19,48 +19,12 @@ definePageMeta({
const router = useRouter();
const paymentGateways = ref<PaymentGateway[]>([
{
id: 1,
picture: "/img/gateways/zarinpal.png",
title: "زرین پال",
type: "ZARINPAL",
},
{
id: 2,
picture: "/img/gateways/sep.png",
title: "سپ",
type: "SEP",
},
{
id: 3,
picture: "/img/gateways/mellat-bank.png",
title: "بانک ملت",
type: "MELLAT",
},
{
id: 4,
picture: "/img/gateways/idpay.png",
title: "آی دی پی",
type: "IDPAY",
},
{
id: 5,
picture: "/img/gateways/zibal.png",
title: "زیبال",
type: "ZIBAL",
},
{
id: 6,
picture: "/img/gateways/bahamta.png",
title: "باهمتا",
type: "BAHAMTA",
},
{
id: 7,
picture: "/img/gateways/bmi.png",
title: "بانک ملی",
type: "BMI",
},
]);
const selectedGateway = computed({
+15 -6
View File
@@ -24,12 +24,16 @@ definePageMeta({
middleware: ["check-is-not-logged-in"],
});
// state
// seo
useSeoMeta({
title : "ورود به فروشگاه"
title: "ورود به فروشگاه",
});
// state
const route = useRoute();
const { addToast } = useToast();
const { updateToken, updateRefreshToken } = useAuth();
@@ -110,7 +114,6 @@ const handleLogin = async () => {
updateToken(response.access);
updateRefreshToken(response.refresh);
await new Promise((resolve) => setTimeout(resolve, 1000));
await refetchAccount();
addToast({
@@ -120,7 +123,11 @@ const handleLogin = async () => {
},
});
window.location.href = "/";
if (route.query.hasOwnProperty("cb_url")) {
window.location.href = route.query["cb_url"] as string;
} else {
window.location.href = "/";
}
} catch (e) {
otpCode.value = [];
addToast({ message: "مشکلی پیش آمده" });
@@ -161,11 +168,13 @@ const resetForm = () => {
<div
class="max-w-[600px] w-full p-6 h-[350px] sm:h-[400px] flex flex-col items-center bg-white border shadow-black/10 justify-center border-slate-300 rounded-3xl"
>
<h1 class="typo-h-6 sm:typo-h-5 mt-8">شماره خود را وارد کنید</h1>
<h1 class="typo-h-6 sm:typo-h-5 mt-12">
{{ showOtp ? "کد ارسالی را وارد کنید" : "شماره خود را وارد کنید" }}
</h1>
<form
@submit.prevent
class="max-w-[500px] w-full mt-12"
class="max-w-[500px] w-full mt-10"
>
<Input
v-if="!showOtp"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.9 MiB

-6
View File
@@ -1,6 +0,0 @@
import fs from "fs/promises";
export default defineEventHandler(async (event) => {
const oldLogs = await fs.readFile(".logs/log.json", "utf-8");
return JSON.parse(oldLogs) as Record<any, any>[];
});