Contributors
Zishan Kazi (pixel-z)
Issue Resolved
- Change backend to include token timeout and send to frontend
- Issue #6
Files changed (Pull Request)
Requirements
Worked on the files:
tokens.jssrc/request.jssrc/components/homepage/myDatasets.jssrc/components/homepage/myModels.jssrc/components/homepage/myPermissionRequests.jssrc/components/homepage/myRequests.jssrc/components/datasets/allDatasets.jssrc/components/datasets/allVersions.jssrc/components/datasets/viewDatasetModal.jssrc/containers/datasetadd/addDataset.jssrc/containers/datasets/domains.jssrc/containers/homepage/homepage.jssrc/containers/review/reviewPage.jssrc/containers/tnc-edit/TncEdit.jsxsrc/containers/upload/uploadPage.jssrc/containers/upload/uploaderPage.jssrc/containers/verify/verify.js
On login, store the timestamp along with the token. Add a isTokenStillValid function that checks if it has been more than x hrs since the token was generated. Read x from creds.js now, add this function before very request
Make a request module that exports a custom version of axios with heads to all hooks / components making requests. E.g: a module that exports
Design Step
- Tech stack being used:
ReactJS - Changed
/loginroute, bug fixes in validTill. - Changing all the axios requests and replacing through a wrapper function of
getWithLogin()andpostWithLogin(). - The wrapper functions check whether the token is valid or not, if not, it redirects to login page.
- Changed all the files where the user data is is being accessed using localStorage.