Skip to content

Sample State

gty3310 edited this page Aug 8, 2018 · 3 revisions

Sample State

let state = {
  entities: {
    Posts: {
        1: {
          id: 1,
          name: "Post 1 name",
          headline: "Post 1 headline",
          description: "sample description 1",
          user_id: 11,
          image_url: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Apple_logo_black.svg/2000px-Apple_logo_black.svg.png"
          comment_count: 2,
          created_at: 'date-time'

        },

        2: {
          id: 2,
          name: "Post 2 name",
          headline: "Post 2 headline",
          description: "sample description 2",
          user_id: 11,
          image_url: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Apple_logo_black.svg/2000px-Apple_logo_black.svg.png"
          comment_count: 3,
          created_at: 'date-time'
        }
      },

    comments: {
      1: {
        id: 1,
        body: "Comment 1 body",
        postId: 1,
        userId: 2,
      }
      2: {
        id: 2,
        body: "comment 2 body"
        ...
      }
    },

    user: {
      id: 17,
      username: 'username',
      image_url: "https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Apple_logo_black.svg/2000px-Apple_logo_black.svg.png"
      headline: 'phrase one',
      }
    },

  },

  ui: {
    loading: true/false,
  },

  session: {
    currentUser: 2
  },

  errors: {
    session: ['must be logged in to see form'],
    new_Post_form: ['post name can\'t be blank'],
    new_comment_form: ['comment can\'t be blank']
  }
};
Clone this wiki locally