Upload model By calling database API, #1525
Unanswered
Hassaan0316
asked this question in
Q&A
Replies: 1 comment 1 reply
-
this doesnt make much sense to me, you cant call await inside a component and the component cannot be async. or is this a server component, i have never used these before. all you need to do is give useLoader a proper url. if you dont have the url and its an async request then use something like use-asset const fileUrl = useAsset(async (id) => {
const res = await API.get(`...${id}...`)
const json = await res.json()
...
return json.model.fileUrl
}, id)
const { ... } = useGLTF(fileUrl)
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to upload the model by calling API request to the database using async function. But Its not working, if i remove "async/await" it works but for calling API i need to async function otherwise it will not work.
Here is the code snippet i am using to call API and display model.

and this is the error im getting.

I have tries to give URL manually and it works, but working when calling API to get URL. Here just Async function is not working.
Please i need help for that because i have to submit my project the day after tomorrow. Any help will be appreciated...
Beta Was this translation helpful? Give feedback.
All reactions