-
Is it possible to fetch data for using in different places? I was trying to do: // site.ts
import { $fetch } from "ohmyfetch";
const getData = async () => {
const data = await $fetch("https://jsonplaceholder.typicode.com/todos/1");
return data;
};
export default {
title: "îles",
description: "Islands of interactivity with Vue in Vite.js",
test: getData(), // also tried `await getData()` but get an error that can't do top level await
}; But using |
Beta Was this translation helpful? Give feedback.
Answered by
ElMassimo
Nov 21, 2021
Replies: 1 comment
-
In your example, you can Will add a recipes section to the docs with more info in the upcoming weeks. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ElMassimo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In your example, you can
const data = await site.test
in ascript setup
block in a Vue component.Will add a recipes section to the docs with more info in the upcoming weeks.