Nickwang3 / EE461LProject

0 stars 0 forks source link

[SINGLETON] Convert ApiService into singleton object #92

Closed Nickwang3 closed 4 years ago

Nickwang3 commented 4 years ago

Add state to the api service to keep track of requests and other meta data. This class is shared by many components so we ideally only want one of these objects.

Nickwang3 commented 4 years ago

Since all of our react components use this class to request data from our backend, a singleton approach was natural. Added a static getInstance call to retrieve the single instance. ApiService instance stores total number of requests that a user has made across the website. Now limits the user to 10000 requests per session. Took about 1.5 hrs to complete.