1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

add Preferences modal(30%done) & move some modules (actions, reducer, socket, store -> lib/~)

This commit is contained in:
Rokt33r
2015-10-18 17:17:25 +09:00
parent 1df4ed0fe9
commit 88ee94d4b6
16 changed files with 618 additions and 30 deletions

78
lib/actions.js Normal file
View File

@@ -0,0 +1,78 @@
// Action types
export const USER_UPDATE = 'USER_UPDATE'
export const ARTICLE_REFRESH = 'ARTICLE_REFRESH'
export const ARTICLE_UPDATE = 'ARTICLE_UPDATE'
export const ARTICLE_DESTROY = 'ARTICLE_DESTROY'
export const SWITCH_USER = 'SWITCH_USER'
export const SWITCH_FOLDER = 'SWITCH_FOLDER'
export const SWITCH_MODE = 'SWITCH_MODE'
export const SWITCH_ARTICLE = 'SWITCH_ARTICLE'
// Status - mode
export const IDLE_MODE = 'IDLE_MODE'
export const CREATE_MODE = 'CREATE_MODE'
export const EDIT_MODE = 'EDIT_MODE'
// Article status
export const NEW = 'NEW'
export const SYNCING = 'SYNCING'
export const UNSYNCED = 'UNSYNCED'
// DB
export function updateUser (user) {
return {
type: USER_UPDATE,
data: user
}
}
export function refreshArticles (userId, articles) {
return {
type: ARTICLE_REFRESH,
data: { userId, articles }
}
}
export function updateArticle (userId, article) {
return {
type: ARTICLE_UPDATE,
data: { userId, article }
}
}
export function destroyArticle (userId, articleKey) {
return {
type: ARTICLE_DESTROY,
data: { userId, articleKey }
}
}
// Nav
export function switchUser (userId) {
return {
type: SWITCH_USER,
data: userId
}
}
export function switchFolder (folderId) {
return {
type: SWITCH_FOLDER,
data: folderId
}
}
export function switchMode (mode) {
return {
type: SWITCH_MODE,
data: mode
}
}
export function switchArticle (articleKey) {
return {
type: SWITCH_ARTICLE,
data: articleKey
}
}