Completion of APIs except for user progress

This commit is contained in:
HAM!DREZA
2024-06-23 11:23:05 +03:30
parent 607ead8528
commit 46dd3d65a0
17 changed files with 356 additions and 411 deletions
+20 -3
View File
@@ -11,7 +11,7 @@
<p
class="text-[3.59vw] md:text-[1.055vw] font-[600] text-[#383E43]"
>
1 روز
{{ roundDay }} روز
</p>
<p
class="text-[2.836vw] md:text-[0.741vw] font-[400] text-[#383E43]"
@@ -373,8 +373,8 @@
<div class="flex justify-center items-center flex-col mt-[1.823vw]">
<img
v-if="authUser.avatarMedia"
:src="authUser?.avatarMedia"
v-if="profileImage"
:src="profileImage"
class="h-[27.949vw] md:h-[7.24vw] w-[27.949vw] md:w-[7.24vw] rounded-full"
alt=""
/>
@@ -530,6 +530,7 @@
<script setup>
const profileImage = useState('profileImage')
const tickets = await useFetch("/api/ticket");
const lastTickets = tickets.data.value.slice(-2);
const myCourses = await useFetch("/api/auth/me");
@@ -537,6 +538,22 @@ const lastCourses = myCourses.data.value.course.slice(-2);
const balance = await useFetch("/api/user/balance");
const { authUser } = useAuth();
const today = new Date(); // تاریخ امروز
const pastDate = new Date(authUser.value.createdAt); // تاریخ گذشته
// تفاوت زمانی را محاسبه می‌کنیم
const timeDifference = today.getTime() - pastDate.getTime();
// تبدیل میلی‌ثانیه به روز
const dayDifference = timeDifference / (1000 * 3600 * 24);
const roundDay = Math.ceil(dayDifference)
console.log(`تفاوت بین تاریخ امروز و تاریخ گذشته: ${roundDay} روز`);
console.log(today);
console.log(today - authUser.value.createdAt);
definePageMeta({
middleware: "auth",
});