diff --git a/src/api.ts b/src/api.ts index 584220a..b85d680 100644 --- a/src/api.ts +++ b/src/api.ts @@ -565,6 +565,7 @@ export default { messages: buildMessagesConfig(response), worlds: buildWorlds(response), components: buildComponents(response), + loggedIn: response.loggedin || false, } }); }, diff --git a/src/dynmap.d.ts b/src/dynmap.d.ts index d063f1d..5f3342b 100644 --- a/src/dynmap.d.ts +++ b/src/dynmap.d.ts @@ -163,6 +163,7 @@ interface DynmapConfigurationResponse { messages: DynmapMessageConfig, worlds: Array, components: DynmapComponentConfig, + loggedIn: boolean, } interface DynmapUpdateResponse { diff --git a/src/store/actions.ts b/src/store/actions.ts index fb20782..e7bf094 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -83,6 +83,7 @@ export const actions: ActionTree & Actions = { commit(MutationTypes.SET_MESSAGES, config.messages); commit(MutationTypes.SET_WORLDS, config.worlds); commit(MutationTypes.SET_COMPONENTS, config.components); + commit(MutationTypes.SET_LOGGED_IN, config.loggedIn); let worldName, mapName; diff --git a/src/store/mutation-types.ts b/src/store/mutation-types.ts index 866634c..61ed84c 100644 --- a/src/store/mutation-types.ts +++ b/src/store/mutation-types.ts @@ -51,4 +51,6 @@ export enum MutationTypes { SET_SMALL_SCREEN = 'setSmallScreen', TOGGLE_UI_ELEMENT_VISIBILITY = 'toggleUIElementVisibility', SET_UI_ELEMENT_VISIBILITY = 'setUIElementVisibility', + + SET_LOGGED_IN = 'setLoggedIn', } \ No newline at end of file diff --git a/src/store/mutations.ts b/src/store/mutations.ts index cbdfb48..55cc404 100644 --- a/src/store/mutations.ts +++ b/src/store/mutations.ts @@ -73,6 +73,8 @@ export type Mutations = { [MutationTypes.SET_SMALL_SCREEN](state: S, payload: boolean): void [MutationTypes.TOGGLE_UI_ELEMENT_VISIBILITY](state: S, payload: DynmapUIElement): void [MutationTypes.SET_UI_ELEMENT_VISIBILITY](state: S, payload: {element: DynmapUIElement, state: boolean}): void + + [MutationTypes.SET_LOGGED_IN](state: S, payload: boolean): void } export const mutations: MutationTree & Mutations = { @@ -432,5 +434,9 @@ export const mutations: MutationTree & Mutations = { } payload.state ? state.ui.visibleElements.add(payload.element) : state.ui.visibleElements.delete(payload.element); + }, + + [MutationTypes.SET_LOGGED_IN](state: State, payload: boolean): void { + state.loggedIn = payload; } } \ No newline at end of file