starting to implement search page
This commit is contained in:
parent
d016d6fb16
commit
d29fc6c8f6
@ -78,9 +78,12 @@ class SettingsController extends ApiController {
|
||||
* @NoAdminRequired
|
||||
*/
|
||||
public function setMenuState($menuState = ""): JSONResponse {
|
||||
if ($menuState == 'SEARCH') {
|
||||
return true;
|
||||
};
|
||||
$legalArguments = ['TOP', 'RECENT', 'NEW', 'FAVORITES', 'CATEGORIES'];
|
||||
if (!in_array($menuState, $legalArguments)) {
|
||||
$menuState = 'TOP';
|
||||
return new JSONResponse(['status' => 'error'], Http::STATUS_BAD_REQUEST);
|
||||
}
|
||||
return $this->setSetting(
|
||||
'menuState',
|
||||
|
@ -75,10 +75,9 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.loadSettings()
|
||||
console.log('my route ', this.$route.name)
|
||||
},
|
||||
mounted() {
|
||||
this.loadStations()
|
||||
this.onRoute()
|
||||
this.scroll()
|
||||
},
|
||||
methods: {
|
||||
@ -162,6 +161,8 @@ export default {
|
||||
loadStations(menuState = 'TOP') {
|
||||
|
||||
const vm = this
|
||||
const queryBase = this.$apiUrl + '/json/stations'
|
||||
|
||||
if (vm.offset === 0) {
|
||||
vm.pageLoading = true
|
||||
}
|
||||
@ -173,7 +174,13 @@ export default {
|
||||
sortBy = 'lastchangetime'
|
||||
}
|
||||
|
||||
this.$jquery.getJSON(this.$apiUrl + '/json/stations',
|
||||
let queryURI = queryBase
|
||||
if (menuState === 'SEARCH') {
|
||||
const searchQuery = vm.$route.params.query
|
||||
queryURI = queryBase + '/byname/' + searchQuery
|
||||
}
|
||||
|
||||
this.$jquery.getJSON(queryURI,
|
||||
{
|
||||
limit: 20,
|
||||
order: sortBy,
|
||||
|
Loading…
Reference in New Issue
Block a user