Fix server url for js client in accounts and settings

This commit is contained in:
Benedikt Kulmann
2021-01-13 08:26:51 +01:00
parent 20e150228c
commit 17a1d29d6a
5 changed files with 27 additions and 53 deletions

File diff suppressed because one or more lines are too long

View File

@@ -92,7 +92,7 @@ export default {
},
computed: {
...mapGetters(['user', 'configuration']),
...mapGetters(['user', 'getServerForJsClient']),
...mapState('Accounts', ['roles', 'selectedAccounts']),
selectAccountLabel () {
@@ -114,7 +114,7 @@ export default {
injectAuthToken(this.user.token)
const response = await RoleService_AssignRoleToUser({
$domain: this.configuration.server,
$domain: this.getServerForJsClient,
body: {
account_uuid: this.account.id,
role_id: roleId
@@ -139,7 +139,7 @@ export default {
injectAuthToken(this.user.token)
const response = await RoleService_ListRoleAssignments({
$domain: this.configuration.server,
$domain: this.getServerForJsClient,
body: {
account_uuid: this.account.id
}

View File

@@ -31,7 +31,8 @@ const getters = {
})
},
areAllAccountsSelected: state => state.accounts.length === state.selectedAccounts.length,
isAnyAccountSelected: state => state.selectedAccounts.length > 0
isAnyAccountSelected: state => state.selectedAccounts.length > 0,
getServerForJsClient: (state, getters, rootState, rootGetters) => rootGetters.configuration.server.replace(/\/$/, '')
}
const mutations = {
@@ -94,11 +95,11 @@ const actions = {
}
},
async fetchAccounts ({ commit, rootGetters }) {
async fetchAccounts ({ commit, getters, rootGetters }) {
injectAuthToken(rootGetters.user.token)
try {
const response = await AccountsService_ListAccounts({
$domain: rootGetters.configuration.server.replace(/\/$/, ''),
$domain: getters.getServerForJsClient,
body: {}
})
if (response.status === 201) {
@@ -111,11 +112,11 @@ const actions = {
commit('SET_FAILED', true)
},
async fetchRoles ({ commit, rootGetters }) {
async fetchRoles ({ commit, getters, rootGetters }) {
injectAuthToken(rootGetters.user.token)
try {
const response = await RoleService_ListRoles({
$domain: rootGetters.configuration.server.replace(/\/$/, ''),
$domain: getters.getServerForJsClient,
body: {}
})
if (response.status === 201) {
@@ -132,7 +133,7 @@ const actions = {
getters.areAllAccountsSelected ? commit('RESET_ACCOUNTS_SELECTION') : commit('SET_SELECTED_ACCOUNTS', [...state.accounts])
},
async setAccountActivated ({ commit, dispatch, state, rootGetters }, activated) {
async setAccountActivated ({ commit, dispatch, state, getters, rootGetters }, activated) {
const failedAccounts = []
injectAuthToken(rootGetters.user.token)
@@ -143,7 +144,7 @@ const actions = {
try {
const response = await AccountsService_UpdateAccount({
$domain: rootGetters.configuration.server.replace(/\/$/, ''),
$domain: getters.getServerForJsClient,
body: {
account: {
id: account.id,
@@ -181,12 +182,13 @@ const actions = {
commit('RESET_ACCOUNTS_SELECTION')
return Promise.resolve(true)
},
async createNewAccount ({ rootGetters, commit, dispatch }, account) {
async createNewAccount ({ getters, rootGetters, commit, dispatch }, account) {
injectAuthToken(rootGetters.user.token)
try {
const response = await AccountsService_CreateAccount({
$domain: rootGetters.configuration.server.replace(/\/$/, ''),
$domain: getters.getServerForJsClient,
body: {
account: {
on_premises_sam_account_name: account.username,
@@ -214,7 +216,7 @@ const actions = {
return Promise.resolve(false)
},
async deleteAccounts ({ rootGetters, state, commit, dispatch }) {
async deleteAccounts ({ getters, rootGetters, state, commit, dispatch }) {
const failedAccounts = []
injectAuthToken(rootGetters.user.token)
@@ -222,7 +224,7 @@ const actions = {
for (const account of state.selectedAccounts) {
try {
const response = await AccountsService_DeleteAccount({
$domain: rootGetters.configuration.server.replace(/\/$/, ''),
$domain: getters.getServerForJsClient,
body: {
id: account.id
}

File diff suppressed because one or more lines are too long

View File

@@ -25,7 +25,8 @@ const getters = {
.sort((b1, b2) => {
return b1.name.localeCompare(b2.name)
})
}
},
getServerForJsClient: (state, getters, rootState, rootGetters) => rootGetters.configuration.server.replace(/\/$/, '')
}
const mutations = {
@@ -51,11 +52,11 @@ const actions = {
commit('SET_INITIALIZED', true)
},
async fetchBundles ({ commit, dispatch, rootGetters }) {
async fetchBundles ({ commit, dispatch, getters, rootGetters }) {
injectAuthToken(rootGetters)
try {
const response = await BundleService_ListBundles({
$domain: rootGetters.configuration.server.replace(/\/$/, ''),
$domain: getters.getServerForJsClient,
body: {}
})
if (response.status === 201) {
@@ -96,7 +97,7 @@ const actions = {
injectAuthToken(rootGetters)
try {
const response = await ValueService_SaveValue({
$domain: rootGetters.configuration.server.replace(/\/$/, ''),
$domain: getters.getServerForJsClient,
body: {
value: payload
}