Move Xhr requests to Rest endpoints
## Description In addition to the Model/Gateway refactoring &1 it would be good to move network requests from the old XHR to new REST endpoints and have a more simple API. There are already several ones in https://gitlab.com/foodsharing-dev/foodsharing/-/tree/master/src/Controller that can be used or extended. ## Goal * Separate front-end and back-end stuff as there are still many XHR functions that return Javascript or HTML * Make it easier to work on the UI, e.g. to refactor it into Vue components * Maybe fix some encoding bugs in the same time ## List of old endpoints These are all I could find for now, please add more if you find any: * [x] [ActivityXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Activity/ActivityXhr.php) (still needs refactoring in foodsharing#9) * [x] [ApplicationXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Application/ApplicationXhr.php) * [x] [BasketXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Basket/BasketXhr.php) * [x] [BellXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Bell/BellXhr.php) * [x] [BuddyXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Buddy/BuddyXhr.php) foodsharing#847 foodsharing!1646 * [x] [EmailXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Email/EmailXhr.php) foodsharing!1354 * [x] [EventXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Event/EventXhr.php) * [x] [FoodsaverXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Foodsaver/FoodsaverXhr.php) * [x] [LoginXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Login/LoginXhr.php) foodsharing#819 foodsharing!1632 foodsharing!1642 * [x] [MailboxXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Mailbox/MailboxXhr.php) See: foodsharing#789 * [x] [MainXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Main/MainXhr.php) * [x] [MapXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Map/MapXhr.php) (standardise the markers to GPX or GeoJSON ?) * [x] [MessageXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Message/MessageXhr.php) (included in foodsharing!887) * [x] [ProfileXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Profile/ProfileXhr.php) foodsharing#903 * [x] [QuizXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Quiz/QuizXhr.php) * [x] [RegionAdminXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/RegionAdmin/RegionAdminXhr.php) foodsharing!1547 * [x] [RegionXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Region/RegionXhr.php) * [x] [ReportXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Report/ReportXhr.php) * [x] [SearchXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Search/SearchXhr.php) foodsharing!1522 * [x] [SettingsXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Settings/SettingsXhr.php) * [x] [StoreXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Store/StoreXhr.php) (still needs refactoring in foodsharing#9, foodsharing!1196) foodsharing#885 * [x] [TeamXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/Team/TeamXhr.php) * [x] [WallPost](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/WallPost/WallPostXhr.php) * [x] [WorkGroupXhr](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Modules/WorkGroup/WorkGroupXhr.php) * [x] [XhrMethods](https://gitlab.com/foodsharing-dev/foodsharing/-/blob/master/src/Lib/Xhr/XhrMethods.php) foodsharing#261 foodsharing#823 ### Endpoints sorted by extent ``` Modules % find . -name '*Xhr.php' | xargs wc -l | sort -nr 2178 insgesamt 1169 ./Quiz/QuizXhr.php 216 ./Basket/BasketXhr.php 198 ./WorkGroup/WorkGroupXhr.php 129 ./Store/StoreXhr.php 119 ./Report/ReportXhr.php 98 ./Settings/SettingsXhr.php 94 ./Foodsaver/FoodsaverXhr.php 78 ./Team/TeamXhr.php 47 ./Region/RegionXhr.php 30 ./Map/MapXhr.php ``` When working on replacing one specific method, best create an issue for that task and link it with your merge request :)
epic