File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 53
53
Stores near you ({{ destinationLocations.length }} results)
54
54
</p >
55
55
</div >
56
+ <div v-else >
57
+ <ProgressSpinner v-if =" awaitingAPIResponse" />
58
+ </div >
56
59
<div
57
60
v-if =" destinationLocations.length > 0"
58
61
style =" display : flex ; gap : 10px ; flex-wrap : wrap ; width : 100% ; text-align : center ;"
125
128
selectedDeparturePlace: " " ,
126
129
suggestedDeparturePlaces: [],
127
130
departureLocation: {},
128
- destinationLocations: []
131
+ destinationLocations: [],
132
+ // Are we waiting for an API response?
133
+ awaitingAPIResponse: false
129
134
}
130
135
},
131
136
watch: {
193
198
" MaxResults" : this .maxResults
194
199
}
195
200
// Hash used to drive caching behaviour on server-side.
201
+ this .awaitingAPIResponse = true
196
202
this .generateHash (JSON .stringify (post_request)).then (data =>
197
203
{
198
204
axios .post (this .apiEndpoint + " /nearest" , post_request, {params: {hash: data}}).then (response => {
199
205
this .destinationLocations = response .data
206
+ this .awaitingAPIResponse = false
200
207
}).catch (error => {
201
208
console .log (error)
202
209
this .errorMessage = error .message
203
210
if (error .hasOwnProperty (" response" )) {
204
211
this .errorMessage = this .errorMessage + " " + error .response .data
205
212
}
213
+ this .awaitingAPIResponse = false
206
214
})
207
215
})
208
216
},
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import Button from "primevue/button"
8
8
import AutoComplete from "primevue/autocomplete"
9
9
import Dropdown from "primevue/dropdown" ;
10
10
import Message from "primevue/message" ;
11
+ import ProgressSpinner from 'primevue/progressspinner' ;
11
12
import "primevue/resources/themes/saga-blue/theme.css"
12
13
import "primevue/resources/primevue.min.css"
13
14
import "primeicons/primeicons.css"
@@ -22,5 +23,6 @@ myApp.component("Button", Button)
22
23
myApp . component ( "AutoComplete" , AutoComplete )
23
24
myApp . component ( "Dropdown" , Dropdown )
24
25
myApp . component ( "Message" , Message )
26
+ myApp . component ( "ProgressSpinner" , ProgressSpinner )
25
27
26
28
myApp . mount ( '#app' )
You can’t perform that action at this time.
0 commit comments