Skip to content

Sample State

trwong edited this page Nov 16, 2017 · 12 revisions
  entities: {
    users: {
      1: {
        id: 1,
        first_name: "Taylor",
        last_name: "Wong",
        email: "trwong@email.com",
        img_url: "https://cdn.pixabay.com/photo/2013/11/03/14/56/bird-204842_960_720.jpg",
        friends: [2, 4, 7, 12],
        posts: [1, 6, 12, 43, 73],
      },
      2: {
        id: 2,
        first_name: "John",
        last_name: "Snow",
        email: "jsnow@email.com",
        img_url: "https://cdn.pixabay.com/photo/2003/1/12/15/76/bard-321842_9530_210.jpg",
        friends: [1, 5, 32, 11],
        posts: [4, 53, 56, 63, 84]
      }
    }
    posts: {
      1: {
        id: 1,
        body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
        author: 25,
        likes: 13,
        current_user_likes: true,
        comments: [4, 53, 56, 63, 84]
      },
      2: {
        id: 1,
        body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
        author: 37,
        likes: 68,
        current_user_likes: true,
        comments: [5, 55, 66, 73, 104]
      }
    }
    comments: {
      1: {
        id: 1,
        body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
        author: 63,
        parent_type: "comment",
        parent_id: 32,
        likes: 12,
        current_user_likes: false
      },
      2: {
        id: 2,
        body: "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
        author: 53,
        parent_type: "post",
        parent_id: 64,
        likes: 19,
        current_user_likes: false
      }
    }
  },
  ui: {
    loading: true/false
  },
  errors: {
    login: ["Incorrect username or password"],
    postForm: ["Post body cannot be blank"],
    commentForm: ["Comment body cannot be blank"]
  },
  session: {
    id: 61
  }
}

Clone this wiki locally