Flowseal / TravelPractice

0 stars 1 forks source link

lesson-8: Формировать query строку лучше с помощью URLSearchParams #10

Closed LehaIvanov closed 1 year ago

LehaIvanov commented 1 year ago

https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams

https://github.com/Flowseal/TravelPractice/blob/8e8d193b2c2ee52de62bb03317dd298d916e160b/Lesson8%20(Currency%20Converter)/WebAppUI/src/api-calls/FetchPrice.ts#L7

const response = await fetch(`https://localhost:7120/prices?${new URLSearchParams({
      // API expects DateTimes in in UTC timezone
      FromDateTime: fromDateTime.toISOString(),
      PaymentCurrency: payment,
      PurchasedCurrency: purchased,
    })}`,
  )}}`);