update
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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()
|
||||
// }
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user