diff --git a/client/src/components/LoadingButton.vue b/client/src/components/LoadingButton.vue
new file mode 100644
index 0000000..85edee3
--- /dev/null
+++ b/client/src/components/LoadingButton.vue
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
diff --git a/client/src/store/modules/summoner.js b/client/src/store/modules/summoner.js
index 4acb42a..f440873 100644
--- a/client/src/store/modules/summoner.js
+++ b/client/src/store/modules/summoner.js
@@ -11,11 +11,17 @@ export const state = {
matches: [],
soloQ: {}
},
+ matchesLoading: false,
status: '',
}
export const mutations = {
+ MATCHES_LOADING(state) {
+ state.matchesLoading = true
+ },
MATCHES_FOUND(state, newMatches) {
+ state.matchesLoading = false
+
state.infos.matches = [...state.infos.matches, ...newMatches]
state.infos.matchIndex += newMatches.length
@@ -38,6 +44,8 @@ export const mutations = {
export const actions = {
async moreMatches({ commit }) {
+ commit('MATCHES_LOADING')
+
const account = state.infos.account
const gameIds = state.infos.matchList.slice(state.infos.matchIndex, state.infos.matchIndex + 10).map(({ gameId }) => gameId)
@@ -69,6 +77,7 @@ export const actions = {
}
export const getters = {
+ matchesLoading: state => state.matchesLoading,
moreMatchesToFetch: state => state.infos.matchIndex < state.infos.matchList.length,
summonerFound: state => state.status === 'found',
summonerNotFound: state => state.status === 'error',
diff --git a/client/src/views/Summoner.vue b/client/src/views/Summoner.vue
index f07a90b..fc27167 100644
--- a/client/src/views/Summoner.vue
+++ b/client/src/views/Summoner.vue
@@ -87,11 +87,13 @@
-
+ @clicked="moreMatches"
+ :loading="matchesLoading"
+ btn-class="mt-4 block mx-auto bg-blue-800 px-4 py-2 rounded-md font-semibold hover:bg-blue-1000 shadow-lg"
+ >More matches
+
@@ -113,6 +115,7 @@