Get logged in state from config

This commit is contained in:
James Lyne 2021-01-24 22:35:11 +00:00
parent d6587bf21f
commit 8423a05b84
5 changed files with 11 additions and 0 deletions

View File

@ -565,6 +565,7 @@ export default {
messages: buildMessagesConfig(response),
worlds: buildWorlds(response),
components: buildComponents(response),
loggedIn: response.loggedin || false,
}
});
},

1
src/dynmap.d.ts vendored
View File

@ -163,6 +163,7 @@ interface DynmapConfigurationResponse {
messages: DynmapMessageConfig,
worlds: Array<DynmapWorld>,
components: DynmapComponentConfig,
loggedIn: boolean,
}
interface DynmapUpdateResponse {

View File

@ -83,6 +83,7 @@ export const actions: ActionTree<State, State> & 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;

View File

@ -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',
}

View File

@ -73,6 +73,8 @@ export type Mutations<S = State> = {
[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<State> & Mutations = {
@ -432,5 +434,9 @@ export const mutations: MutationTree<State> & 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;
}
}