Skip to content

sample state

Oguzhan Cakmak edited this page Oct 22, 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
    },
    2: {
      id: 2,
      body: "Where does the sun rise?",
      question_author_id: 69
    }
  },
  answer: {
    26: {
      body: "Because, we have to",
      author_id: 168,
      question_id: 1,
      comments: [1,2]
    },
    13: {
      body: "East",
      answer_author_id: 72,
      question_id: 2,
      comments: [5]
    },
  },
  comments: {
    1 :{
      body: "Ohh man!"
      comment_author_id: 168,
      answer_id:1
    },
    2 :{
      body: "Noo man!"
      comment_author_id: 69,
      answer_id:1
    },
    5 :{
      body: "Noo man!"
      comment_author_id: 11,
      answer_id:2
    }
  }
},
ui: {
  loading: true/false
},
errors: {
  login: ["Incorrect username/password combination"],
  questionForm: ["Question body cannot be blank"],
},
session: {
  currentUser: {
    id: 57,
    username: "omc",
  }
}
Clone this wiki locally