mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-16 18:29:08 +00:00
sync
This commit is contained in:
parent
13cd3bd4a0
commit
52cb96baa3
43 changed files with 3257 additions and 1072 deletions
11
UI/src/reducers/index.js
Normal file
11
UI/src/reducers/index.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
import { combineReducers } from 'redux'
|
||||
|
||||
import servers from './servers'
|
||||
import user from './user'
|
||||
|
||||
const rootReducer = combineReducers({
|
||||
servers,
|
||||
user
|
||||
})
|
||||
|
||||
export default rootReducer
|
36
UI/src/reducers/servers.js
Normal file
36
UI/src/reducers/servers.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
import { Set, Map } from 'immutable'
|
||||
|
||||
const blankServer = Map({
|
||||
'id': '386659935687147521',
|
||||
'gm': {
|
||||
'nickname': null,
|
||||
'color': '#cca1a1'
|
||||
},
|
||||
'server': {
|
||||
'id': '386659935687147521',
|
||||
'name': 'Roleypoly',
|
||||
'ownerID': '62601275618889728',
|
||||
'icon': '4fa0c1063649a739f3fe1a0589aa2c03'
|
||||
},
|
||||
'perms': {
|
||||
'isAdmin': true,
|
||||
'canManageRoles': true
|
||||
}
|
||||
})
|
||||
|
||||
const initialState = Set([])
|
||||
|
||||
export default (state = initialState, { type, data }) => {
|
||||
console.log(__filename, type, data)
|
||||
|
||||
switch (type) {
|
||||
case Symbol.for('update servers'):
|
||||
return data.reduce((acc, s) => acc.add(Map(s)), Set())
|
||||
|
||||
case Symbol.for('add debug server'):
|
||||
return Set([blankServer])
|
||||
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
15
UI/src/reducers/user.js
Normal file
15
UI/src/reducers/user.js
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { Map } from 'immutable'
|
||||
|
||||
const initialState = Map({
|
||||
username: 'あたし',
|
||||
discriminator: '0001',
|
||||
id: '',
|
||||
avatar: null
|
||||
})
|
||||
|
||||
export default (state = initialState, { type, data }) => {
|
||||
switch (type) {
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue