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