|
|
@@ -1,10 +1,14 @@
|
|
|
import {organizationState} from "~/types/types";
|
|
|
+import * as _ from "lodash";
|
|
|
|
|
|
export const state = () => ({
|
|
|
name: '',
|
|
|
product: '',
|
|
|
modules: [],
|
|
|
- hasChildren: false
|
|
|
+ hasChildren: false,
|
|
|
+ website: '',
|
|
|
+ subDomain: '',
|
|
|
+ parents: []
|
|
|
})
|
|
|
|
|
|
export const mutations = {
|
|
|
@@ -19,6 +23,18 @@ export const mutations = {
|
|
|
},
|
|
|
setHasChildren(state:organizationState, hasChildren:boolean) {
|
|
|
state.hasChildren = hasChildren
|
|
|
+ },
|
|
|
+ setParents(state:organizationState, parents:Array<organizationState>) {
|
|
|
+ state.parents = parents
|
|
|
+ },
|
|
|
+ setWebsite(state:organizationState, website:string) {
|
|
|
+ state.website = website
|
|
|
+ },
|
|
|
+ setSubDomain(state:organizationState, subDomain:string) {
|
|
|
+ state.subDomain = subDomain
|
|
|
+ },
|
|
|
+ addParent(state:organizationState, parent:organizationState) {
|
|
|
+ state.parents.push(parent)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -26,7 +42,19 @@ export const actions = {
|
|
|
setProfile(context:any, profile:any){
|
|
|
context.commit('setName', profile.name)
|
|
|
context.commit('setProduct', profile.product)
|
|
|
+ context.commit('setWebsite', profile.website)
|
|
|
+ context.commit('setSubDomain', profile.subDomain)
|
|
|
context.commit('setModules', profile.modules)
|
|
|
context.commit('setHasChildren', profile.hasChildren)
|
|
|
+
|
|
|
+ _.each(profile.parents, parent => {
|
|
|
+ const p:organizationState = {
|
|
|
+ name: parent.name,
|
|
|
+ website: parent.website,
|
|
|
+ subDomain: parent.subDomain,
|
|
|
+ parents: []
|
|
|
+ }
|
|
|
+ context.commit('addParent', p)
|
|
|
+ });
|
|
|
}
|
|
|
}
|