Skip to content

Sample State

Aaron Agarunov edited this page Dec 28, 2017 · 8 revisions
{
  entities: {
    users: {
      12: {
        id: 12,
        username: 'sevdali',
        name: 'Sevda',
        coverPhoto: '/some/url/cover-photo-674.png',
        photoIds: [65, 23],
        likedPhotoIds: [2],
        followerIds: [5, 12],
        followeeIds: [],
        currentUserFollows: true,
      },
      13: {
        id: 13,
        username: 'rosalia-catalina',
        name: 'Rosalia',
        coverPhoto: '/some/url/cover-photo-925.png',
        photoIds: [21],
        likedPhotoIds: [1],
        followerIds: [15],
        followeeIds: [21, 33, 35],
        currentUserFollows: false,
      },
    },
    photos: {
      1: {
        id: 1,
        author_id: 12,
        likes: 20,
        url: '/some/url/photo-122.png',
        location: null,
        title: 'alla Carbonara',
        description: 'bon appetit',
        currentUserLikes: true,
      },
      2: {
        id: 2,
        author_id: 13,
        likes: 1,
        url: '/some/url/photo-262.png',
        location: 'Barcelona',
        title: 'Park Guell',
        description: null,
        currentUserLikes: false,
      },
    },
  },
  ui: {
    isFetching: boolean,
    userProfileDropdown: { showDropdown: false },
    upload: { showModal: false },
    followers: { showModal: false },
    following: { showModal: false },
  },
  errors: {
    session: { username: ['invalid characters'], password: ['must be between 6 and 24 characters long'] },
    permission: ['You do not have permission for that action.'],
    upload: ['invalid file type, only accepting .jpg, .png'],
  },
  session: {
    currentUser: { // user is also in `users` slice
      id: 8,
      username: 'olafur',
    },
  },
}
Clone this wiki locally