Skip to content

Sample State

Cynthia Ma edited this page Feb 4, 2018 · 16 revisions
{
  entities: {
    decks: {
      1: {
        id: 1,
        title: "How to get into a/A",
        author_id: 1,
        tags_ids: [1],
        card_ids: [1, 2]
      }
    },
    cards: {
      1: {
        id: 1,
        keyword: ".uniq"
        body: "Returns a new array by removing duplicate values in self",
        author_id: 1,
        deck_id: 1,
        user_rating: 1,
         },
      2: {
        id: 2,
        keyword: ".select"
        body: "Returns a new array containing all elements of ary for which the given block returns a true value.",
        author_id: 1,
        deck_id: 1,
        user_rating: nil, //or null?
      }
    },
    tags: {
      1: {
        id: 1,
        tag: "software development"
      }
    },
    users: {
      1: {
        id: 1,
        username: "blue_macaw",
        img_url: "http://maxpixel.freegreatpicture.com/static/photo/1x/Wildlife-Tropical-Pet-Colorful-Macaw-Parrot-Bird-410144.jpg"
      }
    }
  },
  ui: {
    loading: true/false
  },
  session: {
    currentUser: {
      id: 1,
      username: "blue_hawk",
      img_url: "https://cdn.pixabay.com/photo/2013/12/29/03/47/hawk-234999_960_720.jpg"
    }
  },
  errors: {
    session: ["Incorrect username/password combination"],
    deckForm: ["deck body cannot be blank"],
    cardForm: ["card body cannot be blank"],
  }
}

Clone this wiki locally