treemapper
treemapper copied to clipboard
Projects loaded from TPO account do not get cleared
Describe the bug If you logged in with a TPO account the projects are downloaded and stored locally. After logging out and login with another account, the old projects are still available. So when registering a new tree and choosing a project not belonging to the new TPO the registration upload failed as following:
POST https://app-development.plant-for-the-planet.org/treemapper/plantLocations
Response:
{
"code": 400,
"message": "Validation Failed",
"errors": {
"children": {
"type": {},
"deviceLocation": {},
"plantDate": {},
"registrationDate": {},
"captureMode": {},
"plantProject": {
"errors": [
"The provided plant project does not belong to the authenticated user."
]
},
"scientificSpecies": {},
"measurements": {
"children": {
"height": {},
"width": {}
}
},
"geometry": {},
"tag": {}
}
}
}
The wrong registration once saved can not be edited any more to delete the wrong project and also currently can not be deleted anymore as well, so is stuck in the app (until uploading it with the TPO belonging to the project).
Is it on a Production or Development Build? develop
To Reproduce Steps to reproduce the behavior:
- Login with a first TPO account with projects
- Logout and login again with another TPO account
- Register tress and choose project of first TPO
- Upload registration
- See error
Expected behavior Delete old locally stored projects on logout and clear them before logging with a new account like for species or registrations.
What actually happens Projects are left locally even if another account got logged in.