mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-23 22:51:42 +00:00
USER auto refresh
This commit is contained in:
@@ -23,7 +23,7 @@ export const UNSYNCED = 'UNSYNCED'
|
||||
export function updateUser (user) {
|
||||
return {
|
||||
type: USER_UPDATE,
|
||||
data: user
|
||||
data: { user }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ function getInitialArticles () {
|
||||
function currentUser (state, action) {
|
||||
switch (action.type) {
|
||||
case USER_UPDATE:
|
||||
let user = action.data
|
||||
let user = action.data.user
|
||||
|
||||
return auth.user(user)
|
||||
default:
|
||||
|
||||
@@ -2,7 +2,7 @@ import { API_URL } from '../config'
|
||||
import socketio from 'socket.io-client'
|
||||
import auth from './auth'
|
||||
import store from './store'
|
||||
import { updateArticle, destroyArticle } from './actions'
|
||||
import { updateUser, updateArticle, destroyArticle } from './actions'
|
||||
|
||||
export const CONN = 'CONN'
|
||||
export const ALERT = 'ALERT'
|
||||
@@ -27,6 +27,8 @@ io.on(ALERT, function (data) {
|
||||
|
||||
io.on(USER_UPDATE, function (data) {
|
||||
console.log(USER_UPDATE, data)
|
||||
let { user } = data
|
||||
store.dispatch(updateUser(user))
|
||||
})
|
||||
|
||||
io.on(ARTICLE_UPDATE, function (data) {
|
||||
|
||||
Reference in New Issue
Block a user