mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-03-11 03:49:07 +00:00
Linting
This commit is contained in:
@@ -1,41 +1,48 @@
|
||||
const capitalize = (string) => {
|
||||
return string.includes(' ') ?
|
||||
string.split(' ').map(word => word.charAt(0).toUpperCase() + word.slice(1).replace('_', ' ')).join(' ')
|
||||
: string.charAt(0).toUpperCase() + string.slice(1)
|
||||
}
|
||||
const capitalize = string => {
|
||||
if (!string) return;
|
||||
|
||||
const setDocumentTitle = (state) => {
|
||||
document.title = `${state.emoji} ${state.titlePrefix} | ${capitalize(state.title)}`
|
||||
}
|
||||
return string.includes(" ")
|
||||
? string
|
||||
.split(" ")
|
||||
.map(
|
||||
word => word.charAt(0).toUpperCase() + word.slice(1).replace("_", " ")
|
||||
)
|
||||
.join(" ")
|
||||
: string.charAt(0).toUpperCase() + string.slice(1);
|
||||
};
|
||||
|
||||
const setDocumentTitle = state => {
|
||||
document.title = `${state.emoji} ${state.titlePrefix} | ${capitalize(
|
||||
state.title
|
||||
)}`;
|
||||
};
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
emoji: '',
|
||||
titlePrefix: 'seasoned',
|
||||
emoji: "",
|
||||
titlePrefix: "seasoned",
|
||||
title: undefined
|
||||
},
|
||||
getters: {
|
||||
title: (state) => {
|
||||
return state.title
|
||||
}
|
||||
title: state => state.title
|
||||
},
|
||||
mutations: {
|
||||
SET_EMOJI: (state, emoji) => {
|
||||
state.emoji = emoji
|
||||
setDocumentTitle(state)
|
||||
state.emoji = emoji;
|
||||
setDocumentTitle(state);
|
||||
},
|
||||
SET_TITLE: (state, title) => {
|
||||
state.title = title
|
||||
setDocumentTitle(state)
|
||||
state.title = title;
|
||||
setDocumentTitle(state);
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
updateEmoji({ commit }, emoji) {
|
||||
commit('SET_EMOJI', emoji)
|
||||
commit("SET_EMOJI", emoji);
|
||||
},
|
||||
updateTitle({ commit }, title) {
|
||||
commit('SET_TITLE', title)
|
||||
commit("SET_TITLE", title);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user