44 lines
1.1 KiB
TypeScript
44 lines
1.1 KiB
TypeScript
// import type { Posts, Post } from "~/types/post";
|
|
|
|
// // import { Posts } from './Posts';
|
|
// // type PostsType = Posts as typeof Posts;
|
|
|
|
// export const usePost = (res: Posts): Posts => {
|
|
// return res;
|
|
// };
|
|
|
|
// // const param1 = ref('value1')
|
|
// // const { data, status, error, refresh } = await useFetch('/api/modules', {
|
|
// // query: { param1, param2: 'value2' }
|
|
// // })
|
|
|
|
// export const getPosts = async () => {
|
|
|
|
// return await $fetch("https://jsonplaceholder.typicode.com/posts")
|
|
// .then((res) => {
|
|
// return res;
|
|
// })
|
|
// .catch((error) => {
|
|
// throw createError({
|
|
// ...error,
|
|
// statusMessage: `Could not fetch posts`,
|
|
// });
|
|
// });
|
|
// };
|
|
|
|
// // export const getPost = async (id: number) => {
|
|
|
|
// // const { data, status, error, refresh, clear } = await useFetch(
|
|
// // `https://jsonplaceholder.typicode.com/posts/${id}`
|
|
// // );
|
|
|
|
// // if (error.value) {
|
|
// // throw createError({
|
|
// // ...error.value,
|
|
// // statusMessage: `Could not fetch posts`,
|
|
// // });
|
|
// // }
|
|
|
|
// // return data;
|
|
// // };
|