forked from AkkomaGang/akkoma-fe
remove recentqueries thing
This commit is contained in:
parent
f1175b4e9b
commit
4e0b4427a9
1 changed files with 1 additions and 13 deletions
|
@ -225,12 +225,6 @@ export const mutations = {
|
||||||
signUpFailure (state, errors) {
|
signUpFailure (state, errors) {
|
||||||
state.signUpPending = false
|
state.signUpPending = false
|
||||||
state.signUpErrors = errors
|
state.signUpErrors = errors
|
||||||
},
|
|
||||||
addRecentQuery (state, query) {
|
|
||||||
state.recentQueries = state.recentQueries.concat(query)
|
|
||||||
if (state.recentQueries.length > 10) {
|
|
||||||
state.recentQueries = state.recentQueries.slice(1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,8 +251,7 @@ export const defaultState = {
|
||||||
usersObject: {},
|
usersObject: {},
|
||||||
signUpPending: false,
|
signUpPending: false,
|
||||||
signUpErrors: [],
|
signUpErrors: [],
|
||||||
relationships: {},
|
relationships: {}
|
||||||
recentQueries: []
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const users = {
|
const users = {
|
||||||
|
@ -436,13 +429,8 @@ const users = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
searchUsers ({ rootState, commit }, { query }) {
|
searchUsers ({ rootState, commit }, { query }) {
|
||||||
// Don't fetch if this query was already done recently
|
|
||||||
if (rootState.users.recentQueries.includes(query)) {
|
|
||||||
return Promise.resolve([])
|
|
||||||
}
|
|
||||||
return rootState.api.backendInteractor.searchUsers({ query })
|
return rootState.api.backendInteractor.searchUsers({ query })
|
||||||
.then((users) => {
|
.then((users) => {
|
||||||
commit('addRecentQuery', query)
|
|
||||||
commit('addNewUsers', users)
|
commit('addNewUsers', users)
|
||||||
return users
|
return users
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue