This commit is contained in:
HAM!DREZA
2024-05-31 00:03:10 +03:30
parent fd5b06c2d7
commit 2242ed022f
17 changed files with 379 additions and 96 deletions
@@ -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;
}
+33
View File
@@ -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()
// }
+1 -2
View File
@@ -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;
@@ -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) {
-2
View File
@@ -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) {
+27
View File
@@ -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
}
})