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