diff --git a/components/Card.vue b/components/Card.vue index c383250..5d68162 100644 --- a/components/Card.vue +++ b/components/Card.vue @@ -3,12 +3,12 @@

- 540,000 + {{props.course?.price}},000 تومان

@@ -17,10 +17,10 @@
- {{props.course?.name}} - +

- بک اند + + {{category.name}} + + +

- 825 دانشجو + {{props.course?.studentsCount}} دانشجو

- 00:28 + {{props.course?.duration}} ساعت

@@ -127,7 +142,7 @@ \ No newline at end of file diff --git a/layouts/profile.vue b/layouts/profile.vue index d6e35ad..50f21b5 100644 --- a/layouts/profile.vue +++ b/layouts/profile.vue @@ -245,7 +245,14 @@

- علی مصلحی عزیز خوش اومدی + + {{authUser?.name}} + + + کاربر + + + عزیز خوش اومدی

- +
-
- +
+
+ +
-
- + + ویرایش +
+
\ No newline at end of file diff --git a/pages/account/tickets.vue b/pages/account/tickets.vue index b01dcd0..04c5db4 100644 --- a/pages/account/tickets.vue +++ b/pages/account/tickets.vue @@ -385,7 +385,6 @@ import { useToast } from 'vue-toastification' const toast = useToast() const { data: tickets, refresh: load } = await useFetch("/api/ticket"); -console.log('cli tick', tickets); const loading = ref(false); const addTicketForm = ref(false); const subject = ref(null); @@ -401,12 +400,13 @@ const sendTicket = async () => { const data = await useFetch("/api/ticket", { method: "POST", body: { - subject, + subject: subject.value, }, }); - subject.value = ''; - addTicketForm.value = false; load() + addTicketForm.value = false; + subject.value = null; + console.log('تیکت',data); }; @@ -424,9 +424,6 @@ const openTicket = async (data) => { } } - - - const {data: single, refresh: reload} = await useFetch("/api/ticket/id", { method: "POST", body: { diff --git a/pages/courses/index.vue b/pages/courses/index.vue index 08e8666..75eb73b 100644 --- a/pages/courses/index.vue +++ b/pages/courses/index.vue @@ -3,7 +3,7 @@
- +
diff --git a/server/api/course.get.js b/server/api/category.get.js similarity index 74% rename from server/api/course.get.js rename to server/api/category.get.js index 89e89d9..82a8fe7 100644 --- a/server/api/course.get.js +++ b/server/api/category.get.js @@ -1,13 +1,13 @@ export default defineEventHandler(async (event) => { const { public: { apiBase } } = useRuntimeConfig(); try { - const data = await $fetch(`${apiBase}/course`, { + const categoryLis = await $fetch(`${apiBase}/courseCategory`, { method: 'GET', headers: { 'Accept': 'application/json', } }); - return data; + return categoryLis; } catch (error) { return error; } diff --git a/server/api/course.js b/server/api/course.js new file mode 100644 index 0000000..ff4e4ed --- /dev/null +++ b/server/api/course.js @@ -0,0 +1,33 @@ +export default defineEventHandler(async (event) => { + const { public: { apiBase } } = useRuntimeConfig(); + const body = await readBody(event); + console.log(body); + + try { + const data = await $fetch(`${apiBase}/course${body.changeCategory}`, { + method: 'GET', + headers: { + 'Accept': 'application/json', + } + }); + return data; + } catch (error) { + return error; + } + +}) + + + + +// const page = ref(0); + +// const { data, refresh } = await useFetch(() => '/api/global', { +// query: { url: '/orders', page }, +// headers: useRequestHeaders(['cookie']) +// }) + +// function paginate(value) { +// page.value = value; +// refresh() +// } \ No newline at end of file diff --git a/server/api/ticket/id.js b/server/api/ticket/id.js index f99fead..37e0ed2 100644 --- a/server/api/ticket/id.js +++ b/server/api/ticket/id.js @@ -3,7 +3,7 @@ export default defineEventHandler(async (event) => { const { public: { apiBase } } = useRuntimeConfig(); const token = getCookie(event, 'token'); const body = await readBody(event); -console.log('body', body.id); + console.log('badane :', body); try { const data = await $fetch(`${apiBase}/ticket/${body.id}`, { method: 'GET', @@ -13,7 +13,6 @@ console.log('body', body.id); }, id: body.id }); - console.log('tttt :', data); return data; } catch (error) { return error; diff --git a/server/api/ticket/index.post.js b/server/api/ticket/index.js similarity index 93% rename from server/api/ticket/index.post.js rename to server/api/ticket/index.js index 1b069f6..a45a85c 100644 --- a/server/api/ticket/index.post.js +++ b/server/api/ticket/index.js @@ -3,7 +3,7 @@ export default defineEventHandler(async (event) => { const { public: { apiBase } } = useRuntimeConfig(); const token = getCookie(event, 'token'); const body = await readBody(event); - +console.log(body); try { const data = await $fetch(`${apiBase}/ticket`, { method: 'POST', @@ -11,8 +11,9 @@ export default defineEventHandler(async (event) => { 'Accept': 'application/json', 'Authorization': `Bearer ${token}` }, - body + body, }); + return data; } catch (error) { diff --git a/server/api/ticket/message.post.js b/server/api/ticket/message.post.js index 595bda9..b28aaf6 100644 --- a/server/api/ticket/message.post.js +++ b/server/api/ticket/message.post.js @@ -3,7 +3,6 @@ export default defineEventHandler(async (event) => { const { public: { apiBase } } = useRuntimeConfig(); const token = getCookie(event, 'token'); const body = await readBody(event); -console.log('bod' , body); try { const data = await $fetch(`${apiBase}/ticket/message`, { method: 'POST', @@ -13,7 +12,6 @@ console.log('bod' , body); }, body }); - console.log('new :', data); return data; } catch (error) { // if (error.statusCode == 401) { diff --git a/server/api/user/update.js b/server/api/user/update.js new file mode 100644 index 0000000..44ceebb --- /dev/null +++ b/server/api/user/update.js @@ -0,0 +1,27 @@ +export default defineEventHandler(async (event) => { + const body = await readBody(event); + const { public: { apiBase } } = useRuntimeConfig(); + const token = getCookie(event, 'token'); + console.log(body); + try { + const data = await $fetch(`${apiBase}/user/update`, { + method: 'PUT', + body: { + avatarMediaId: "", + name: body.name, + lastName: "", + userName: "", + email: body.email, + userName: body.userName + }, + headers: { + 'Accept': 'application/json', + 'Authorization': `Bearer ${token}` + } + }); + return data; + } catch (err) { + return err + } + +}) \ No newline at end of file