mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Merge pull request #500 from YunoHost/fix-domains
fix main_domain api call with ugly cache override from domain list
This commit is contained in:
commit
180b172f53
5 changed files with 11 additions and 10 deletions
|
@ -30,8 +30,9 @@ export default {
|
|||
}),
|
||||
|
||||
mutations: {
|
||||
'SET_DOMAINS' (state, [domains]) {
|
||||
'SET_DOMAINS' (state, [{ domains, main }]) {
|
||||
state.domains = domains
|
||||
state.main_domain = main
|
||||
},
|
||||
|
||||
'SET_DOMAINS_DETAILS' (state, [name, details]) {
|
||||
|
@ -58,9 +59,10 @@ export default {
|
|||
state.domains.splice(state.domains.indexOf(domain), 1)
|
||||
},
|
||||
|
||||
'SET_MAIN_DOMAIN' (state, [response]) {
|
||||
state.main_domain = response.current_main_domain
|
||||
},
|
||||
// Now applied thru 'SET_DOMAINS'
|
||||
// 'SET_MAIN_DOMAIN' (state, [response]) {
|
||||
// state.main_domain = response.current_main_domain
|
||||
// },
|
||||
|
||||
'UPDATE_MAIN_DOMAIN' (state, [domain]) {
|
||||
state.main_domain = domain
|
||||
|
@ -145,7 +147,10 @@ export default {
|
|||
const ignoreCache = !rootState.cache || noCache || false
|
||||
if (currentState !== undefined && !ignoreCache) return currentState
|
||||
return api.fetch('GET', param ? `${uri}/${param}` : uri, null, humanKey, options).then(responseData => {
|
||||
const data = responseData[storeKey] ? responseData[storeKey] : responseData
|
||||
// FIXME here's an ugly fix to be able to also cache the main domain when querying domains
|
||||
const data = storeKey === 'domains'
|
||||
? responseData
|
||||
: responseData[storeKey] ? responseData[storeKey] : responseData
|
||||
commit(
|
||||
'SET_' + storeKey.toUpperCase(),
|
||||
[param, data, extraParams].filter(item => !isEmptyValue(item))
|
||||
|
|
|
@ -115,7 +115,6 @@ export default {
|
|||
return {
|
||||
queries: [
|
||||
['GET', { uri: 'domains', storeKey: 'domains' }],
|
||||
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
|
||||
['GET', { uri: 'domains', storeKey: 'domains_details', param: this.name }],
|
||||
['GET', `domains/${this.name}/config?full`]
|
||||
],
|
||||
|
|
|
@ -54,7 +54,6 @@ export default {
|
|||
data () {
|
||||
return {
|
||||
queries: [
|
||||
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
|
||||
['GET', { uri: 'domains', storeKey: 'domains' }]
|
||||
],
|
||||
search: '',
|
||||
|
|
|
@ -57,8 +57,7 @@ export default {
|
|||
return {
|
||||
queries: [
|
||||
['GET', { uri: 'users' }],
|
||||
['GET', { uri: 'domains' }],
|
||||
['GET', { uri: 'domains/main', storeKey: 'main_domain' }]
|
||||
['GET', { uri: 'domains' }]
|
||||
],
|
||||
|
||||
form: {
|
||||
|
|
|
@ -115,7 +115,6 @@ export default {
|
|||
return {
|
||||
queries: [
|
||||
['GET', { uri: 'users', param: this.name, storeKey: 'users_details' }],
|
||||
['GET', { uri: 'domains/main', storeKey: 'main_domain' }],
|
||||
['GET', { uri: 'domains' }]
|
||||
],
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue