mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
keyboard layouts from file
This commit is contained in:
@ -55,6 +55,7 @@ export const actions = actionTree(
|
||||
{
|
||||
initialise(store) {
|
||||
accessor.emoji.initialise()
|
||||
accessor.settings.initialise()
|
||||
},
|
||||
|
||||
lock() {
|
||||
|
@ -1,8 +1,13 @@
|
||||
import { getterTree, mutationTree } from 'typed-vuex'
|
||||
import { getterTree, mutationTree, actionTree } from 'typed-vuex'
|
||||
import { get, set } from '~/utils/localstorage'
|
||||
import { accessor } from '~/store'
|
||||
|
||||
export const namespaced = true
|
||||
|
||||
interface KeyboardLayouts {
|
||||
[code: string]: string
|
||||
}
|
||||
|
||||
export const state = () => {
|
||||
return {
|
||||
scroll: get<number>('scroll', 10),
|
||||
@ -11,6 +16,8 @@ export const state = () => {
|
||||
ignore_emotes: get<boolean>('ignore_emotes', false),
|
||||
chat_sound: get<boolean>('chat_sound', true),
|
||||
keyboard_layout: get<string>('keyboard_layout', 'us'),
|
||||
|
||||
keyboard_layouts_list: {} as KeyboardLayouts,
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,4 +53,23 @@ export const mutations = mutationTree(state, {
|
||||
state.keyboard_layout = value
|
||||
set('keyboard_layout', value)
|
||||
},
|
||||
|
||||
setKeyboardLayoutsList(state, value: KeyboardLayouts) {
|
||||
state.keyboard_layouts_list = value
|
||||
},
|
||||
})
|
||||
|
||||
export const actions = actionTree(
|
||||
{ state, getters, mutations },
|
||||
{
|
||||
initialise() {
|
||||
$http
|
||||
.get<KeyboardLayouts>('/keyboard_layouts.json')
|
||||
.then((req) => {
|
||||
accessor.settings.setKeyboardLayoutsList(req.data)
|
||||
console.log(req.data)
|
||||
})
|
||||
.catch(console.error)
|
||||
},
|
||||
},
|
||||
)
|
||||
|
Reference in New Issue
Block a user