async function getCustomerData() { const url = 'http://localhost:5078/api/user'; const CustomerReposeData = await fetch(

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

async function getCustomerData() { const url = 'http://localhost:5078/api/user'; const CustomerReposeData = await fetch(

Post by answerhappygod »

Async Function Getcustomerdata Const Url Http Localhost 5078 Api User Const Customerreposedata Await Fetch 1
Async Function Getcustomerdata Const Url Http Localhost 5078 Api User Const Customerreposedata Await Fetch 1 (104.44 KiB) Viewed 37 times
Hello, In here is a 1 code fetch api from the restful api in
vanilaJS , however, I still need fetch more than 5 source Restful
api Leading to it will delay a 7s to load all content.
=> I pls help me optimize this one by using multithread or
worker ....
To make it run faster.
async function getCustomerData() { const url = 'http://localhost:5078/api/user'; const CustomerReposeData = await fetch(url, init: { method: "GET" contentType: "application/json", headers: { 'Accept': 'application/json', "Content-Type': 'application/json', }, credentials: 'include', mode: 'cors' }) const user_data = await CustomerReposeData.json(); document.querySelector( selectors: "#name").innerHTML = user_data. fullName; document.querySelector( selectors: "#account Number").innerHTML = user_data.primaryAccount.account Number; document.querySelector( selectors: "#primaryBalance").innerHTML = user_data.primaryAccount.accountBalang document.querySelector( selectors: "#savingBalance").innerHTML = user_data.savingsAccount.accountBalance; document.querySelector( selectors: "#image_id").src = user_data.avatar; document.querySelector( selectors: "#imageProfile").src = user_data.avatar; ; - }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply