complete progress section
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { public: { apiBase } } = useRuntimeConfig();
|
||||
const token = getCookie(event, 'token');
|
||||
const query = getQuery(event);
|
||||
|
||||
try {
|
||||
const data = await $fetch(`${apiBase}/uploader/file?fileName=${query.fileName}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
|
||||
}
|
||||
});
|
||||
return data;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -2,7 +2,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}/courseHeadlineComment/create`, {
|
||||
method: 'POST',
|
||||
@@ -12,7 +12,7 @@ console.log(body);
|
||||
},
|
||||
body
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
|
||||
|
||||
@@ -2,7 +2,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}/courseHeadlineComment/reply`, {
|
||||
method: 'POST',
|
||||
|
||||
@@ -13,10 +13,10 @@ export default defineEventHandler(async (event) => {
|
||||
},
|
||||
body
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { public: { apiBase } } = useRuntimeConfig();
|
||||
|
||||
const query = getQuery(event);
|
||||
let category = query.hasOwnProperty('category') ? `categoryId=${query.category}` : '';
|
||||
let page = query.hasOwnProperty('page') ? `page=${query.page}` : '';
|
||||
// let sortBy = query.hasOwnProperty('sortBy') ? `price=${query.price}` : '';
|
||||
let price = query.hasOwnProperty('price') ? `price=${query.price}` : '';
|
||||
let name = query.hasOwnProperty('name') ? `name=${query.name}` : '';
|
||||
try {
|
||||
const data = await $fetch(`${apiBase}/course?${category}&${page}&pageSize=2&${price}&${name}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'content-type': 'application/json'
|
||||
|
||||
}
|
||||
});
|
||||
return data;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
|
||||
});
|
||||
@@ -0,0 +1,22 @@
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { public: { apiBase } } = useRuntimeConfig();
|
||||
const body = await readBody(event);
|
||||
const token = getCookie(event, 'token');
|
||||
|
||||
try {
|
||||
const data = await $fetch(`${apiBase}/course/${body.id}?userId=${body.userId}`, {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
})
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { public: { apiBase } } = useRuntimeConfig();
|
||||
const body = await readBody(event);
|
||||
const token = getCookie(event, 'token');
|
||||
|
||||
try {
|
||||
const data = await $fetch(`${apiBase}/courseHeadline/complete/${body.id}`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
})
|
||||
@@ -7,7 +7,7 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
|
||||
const formData = await readFormData(event);
|
||||
console.log(formData);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
@@ -19,10 +19,10 @@ export default defineEventHandler(async (event) => {
|
||||
'Authorization': `Bearer ${token}`
|
||||
},
|
||||
});
|
||||
console.log('uplodar', data);
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log(error.data);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,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}/user/registerCourse`, {
|
||||
method: 'POST',
|
||||
@@ -12,10 +12,10 @@ export default defineEventHandler(async (event) => {
|
||||
},
|
||||
body
|
||||
});
|
||||
console.log(data);
|
||||
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log('errors',error.data);
|
||||
|
||||
if (error.status === 406) {
|
||||
return{
|
||||
status: 406,
|
||||
|
||||
Reference in New Issue
Block a user