Skip to content

state shape

Sam edited this page Feb 26, 2019 · 4 revisions

State Shape

{
  entities: { 
    users: {
      1: {
        id: 1,
        username: 'bananio',
        name: 'Yahtzee Player',
        profile_body: 'best photo taker EVER',
        email: 'banana@lover.com',
      },
      6001: {
        id: 6001,
        username: 'danish',
        email: 'blue@cheese.com',
        name: 'Baller B',
        profile_body: 'best photo taker EVER',
      },
      10000001: {
        id: 10000001,
        username: 'YARR',
        name: 'Shot Caller'
        profile_body: 'best photo taker EVER'
        email: 'ima@pirate.com',
      },
    },
    posts: {
      1: {
        id: 1,
        image_url: 'thisurl.jpg'
        body: "The best image Ever'
        author_id: 1
      }
      2: {
        id: 2,
        image_url: 'thisurl.jpg'
        body: "The best image Ever'
        author_id: 6001
      }
      3: {
        id: 3,
        image_url: 'thisurl.jpg'
        body: "The best image Ever'
        author_id: 10000001
      }
    },
    post_likes: {
      1: {
        id: 1,
        user_id: 1,
        image_id: 1
      },
      2: {
        id: 2,
        user_id: 6001,
        image_id: 2
      },
      3: {
        id: 3,
        user_id: 1000000,
        image_id: 1
      }
    },
    comments: {
      1: {
        id: 1,
        body: 'This is DOPE!',
        user_id: 6001,
        parent_id: null,
      },
      2: {
        id: 2,
        body: 'Second!',
        user_id: 10000001,
        parent_id: 1,
      },
      3: {
        id: 3,
        body: 'Third!',
        user_id: 1,
        parent_id: 2,
      }
    },
    follows: {
      1: {
        id: 1,
        followed_id: 1,
        follower_id: 10000001
      },
      2: {
        id: 2,
        followed_id: 1,
        follower_id: 6001
      },
      3: {
        id: 3,
        followed_id: 60011,
        follower_id: 10000001
      },
      4: {
        id: 4,
        followed_id: 6001,
        follower_id: 1
      }
    }
  },
  ui: {
    loading: true/false
  },
  errors: {
    login: ["Incorrect username/password combination"],
    imageForm: ["Image must be present"],
    imageLike: [],
    comments: ["body must have text"],
    follows: []
  },
  session: {
    session: { currentUserId: 25 }
  }
 }

note: errors.follows && errors.image_like need updates

Clone this wiki locally