This commit is contained in:
@@ -512,15 +512,14 @@ async function addToProgress() {
|
||||
}
|
||||
watchEffect(() =>{
|
||||
if (route.query.episode === undefined) {
|
||||
episodeId.value = data.value[0].id
|
||||
episodeId.value = data?.value[0]?.id
|
||||
}else{
|
||||
episodeId.value = route.query.episode
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
console.log('route', episodeId.value);
|
||||
console.log(data.value[0].id);
|
||||
|
||||
const { data: progress, refresh: reload } = await useFetch("/api/progress", {
|
||||
query: {
|
||||
id: route.params.product,
|
||||
@@ -614,7 +613,7 @@ if (query.value.hasOwnProperty("episode")) {
|
||||
activeHead.value = data.value[0];
|
||||
const getUrl = await useFetch("/api/checkMedia", {
|
||||
query: {
|
||||
fileName: data.value[0].videoUrl,
|
||||
fileName: data?.value[0]?.videoUrl,
|
||||
},
|
||||
});
|
||||
url.value = getUrl.data.value.url;
|
||||
|
||||
@@ -277,14 +277,16 @@ const paymentHandler = async (id) => {
|
||||
const data = await useFetch("/api/user/registerCourse", {
|
||||
method: "POST",
|
||||
body: {
|
||||
courseId: id,
|
||||
code: "",
|
||||
courseId: id
|
||||
},
|
||||
});
|
||||
if (data?.data?.value?.status === 406 || data?.data?.value?.status === 500) {
|
||||
toast.error(data?.data?.value?.message);
|
||||
} else {
|
||||
console.log(data?.data?.value?.paymentData?.redirectUrl);
|
||||
if (data?.data?.value?.payment?.authority === 'FREE') {
|
||||
toast.success("ثبت نام انجام شد");
|
||||
navigateTo('/account/my-courses')
|
||||
|
||||
} else {
|
||||
location.href = data?.data?.value?.paymentData?.redirectUrl
|
||||
}
|
||||
// setTimeout(() => {
|
||||
// location.reload();
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
<template>
|
||||
<div class="paymentHeight">
|
||||
<div class="payBody">
|
||||
<h1 v-if="route.query.Status === 'OK'">پرداخت با موفقیت انجام شد</h1>
|
||||
<h2 v-else>پرداخت ناموفق !</h2>
|
||||
<div class="buttons">
|
||||
<button class="acceptButton">
|
||||
<nuxt-link to="/">
|
||||
صفحه اصلی
|
||||
</nuxt-link>
|
||||
</button>
|
||||
<button
|
||||
v-if="route.query.Status === 'OK'"
|
||||
class="showButton">
|
||||
<nuxt-link to="/account/my-courses">
|
||||
مشاهده
|
||||
</nuxt-link>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<script setup>
|
||||
const route = useRoute();
|
||||
console.log(route.query.Status === "OK");
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
.acceptButton {
|
||||
background-color: rgb(3, 181, 3);
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
width: 100px;
|
||||
padding: 5px 0px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.showButton {
|
||||
background-color: rgb(181, 160, 3);
|
||||
font-size: 14px;
|
||||
color: #fff;
|
||||
width: 100px;
|
||||
padding: 5px 0px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
.paymentHeight {
|
||||
height: 70vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.payBody {
|
||||
height: 160px;
|
||||
width: 400px;
|
||||
border: 1px solid rgb(205, 205, 205);
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.payBody h1 {
|
||||
color: green;
|
||||
}
|
||||
.payBody h2 {
|
||||
color: red;
|
||||
}
|
||||
.buttons{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 50px;
|
||||
margin-top: 30px;
|
||||
}
|
||||
</style>
|
||||
@@ -4,7 +4,7 @@ export default defineEventHandler(async (event) => {
|
||||
const body = await readBody(event);
|
||||
|
||||
try {
|
||||
const data = await $fetch(`${apiBase}/user/registerCourse`, {
|
||||
const data = await $fetch(`${apiBase}/payment`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
|
||||
Reference in New Issue
Block a user