Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. const fakeDatabase = {
  2. quizzes: [{
  3. id: v4(),
  4. title: 'Get started',
  5. text: 'hey',
  6. completed: true,
  7. hints: [{
  8. id: 1,
  9. text: 'Hint 1'
  10. }, {
  11. id: 2,
  12. text: 'Hint 2'
  13. }]
  14. }, {
  15. id: v4(),
  16. title: 'What are you waiting for?',
  17. text: 'ho',
  18. completed: true,
  19. hints: [{
  20. id: 3,
  21. text: 'Hint 3'
  22. }, {
  23. id: 4,
  24. text: 'Hint 4'
  25. }]
  26. }, {
  27. id: v4(),
  28. title: 'Remember! create more than you consume',
  29. text: 'let’s go',
  30. completed: false,
  31. hints: [{
  32. id: 5,
  33. text: 'Hint 5'
  34. }, {
  35. id: 6,
  36. text: 'Hint 6'
  37. }]
  38. }],
  39. };
  40.  
  41. import { Schema, arrayOf } from 'normalizr';
  42.  
  43. export const hint = new Schema('hints');
  44.  
  45. export const quiz = new Schema('quizzes', {
  46. hints: [ hint ]
  47. });
  48.  
  49. export const arrayOfQuiz = arrayOf(quiz);
  50.  
  51. normalize(response, schema.arrayOfQuiz)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement