Skip to content

Sample State

Roots2D edited this page Dec 27, 2017 · 8 revisions
{
  entities: {
    channels: {
      1: { // current channel
        id: 1,
        name: 'general',
        description: 'general chat',
        imgUrl: 'thunk logo',
        userIds: [1, 2, 3],
        messageIds: [4, 5]
      },
      2: {
        id: 2,
        name: 'general chat 2',
      },
      3: {
        id: 3,
        name: 'general chat 3',
      }
    },
    users: {
      6: {
        id: 1,
        username: 'cody',
        imgUrl: 'cody_pic',
        status: 'active'
      }
      7: {
        id: 2,
        username: 'bob',
        imgUrl: 'bob_pic',
        status: 'away'
      },
      8: {
        id: 3,
        username: 'sally',
        imgUrl: 'sally_pic',
        status: 'busy'
      }
    },
    
    messages: {
      4: {
        id: 4,
        body: 'I love to thunk!',
        userId: 1,
        channelId: 1,
        time: timestamp,
        childMessageIds: [6, 7],
      },
      5: {
        id: 5
        body: 'It's Thunkin' time!',
        userId: 1,
        channelId: 1,
        time: timestamp,
        childMessageIds: []
      }
    }
  },
  
  ui: {
    dropdown: false, // or the dropdown itself
    loading: true,
    currentChannel: 1,
  }
  
  errors: {
    session: ['Invalid credentials'],
    messageForm: ["Message can't be blank"],
    channel: ["Name can't be blank"],
  }
  
  session: {
    currentUser: {
      id: 1,
      username: 'cody',
      imgUrl: 'cody_pic',
      email: "[email protected]"
    }
  }
}

Clone this wiki locally