Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 2 Support (Qt 5) › REST API Called more time

Tagged: 

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24712

    Nicola

    What is the simple way to avoid to call a rest api more time. Let me explain better. If i call the rest apii in onAppear, the call is fectched more time, when appear, when move on the next page and so on. If i call in Component.oncompleted it’s called one time (when the component it created). In the past i created complex solution to avoid this, but i’d like a simple solution.

    #24713

    Alex
    Felgo Team

    Hi Nicola,

    maybe introduce a simple manager item that keeps track of whether a certain URL is currently already being requested? So something like:

    • RESTManager.requestOnce(url, data) –> Sends the request and pushes the url (or more associated data if needed) to an array of currently active request
    • When the response from the request is consumed, the url is removed from the array again
    • If the method is called again, it checks if the url is already in that array and only performs the request if not

    Best,
    Alex

    #24714

    Nicola

    Ok, i thought there is existing a different solution withoiut write code.

Viewing 3 posts - 1 through 3 (of 3 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded