Skip to content

sample state

Oguzhan Cakmak edited this page Oct 26, 2017 · 6 revisions

Sample State

entities: {
  users: {
    11: {
      id: 11,
      username: "michaelJordan23"
    },
    69: {
      id: 69,
      username: "scottyPeppen11"
    },
    72: {
      id: 72,
      username: "ronaldo9"
    },
    168: {
      id: 168,
      username: "george_hagi"
    }
  },
  questions: {
    1: {
      id: 1,
      body: "Why do we breathe?",
      question_author_id: 11,
      answer_ids: [26]
    },
    2: {
      id: 2,
      body: "Where does the sun rise?",
      question_author_id: 69
      answer_ids: [13]
    }
  },
  answer: {
    26: {
      id: 26,
      body: "Because, we have to",
      author_id: 168,
      question_id: 1,
      comments: [1,2]
    },
    13: {
      id: 13,
      body: "East",
      answer_author_id: 72,
      question_id: 2,
      comments: [5]
    },
  },
  comments: {
    1 :{
      id: 1,
      body: "Ohh man!"
      comment_author_id: 168,
      answer_id:1
    },
    2 :{
      id: 2,
      body: "Noo man!"
      comment_author_id: 69,
      answer_id:1
    },
    5 :{
      id: 5,
      body: "Noo man!"
      comment_author_id: 11,
      answer_id:2
    }
  },
  topics: {
    1 :{
      id: 1
      body: "Literature"
    },
    2 :{
      id: 2
      body: "TV Series"
    },
    3 :{
      id: 3
      body: "Fitness"
    }
  }
},
ui: {
  loading: true/false
},
errors: {
  login: ["Incorrect username/password combination"],
  questionForm: ["Question body cannot be blank"],
},
session: {
  currentUser: {
    id: 57,
    username: "omc",
    topic_ids: [1, 2, 3]
  }
}
Clone this wiki locally