-
Notifications
You must be signed in to change notification settings - Fork 2
/
bookInterface.js
44 lines (43 loc) · 1.01 KB
/
bookInterface.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const initialBooks = [
{
id: 1,
title: 'Uyghur History',
author: 'Uyghur',
summary: 'Uyghur History',
image: '/assets/images/uyghurHistory.jpg',
},
{
id: 2,
title: 'Korean Book',
author: 'Korean',
summary: 'Korean Book',
image: '/assets/images/kor.jpg',
},
{
id: 3,
title: 'Indian Book',
author: 'Indian',
summary: 'Indian Book',
image: '/assets/images/ind.jpg',
},
{
id: 4,
title: 'Indian History',
author: 'Indian',
summary: 'Indian History',
image: '/assets/images/indianHistory.jpg',
},
{
id: 5,
title: 'Korean History',
author: 'Korean',
summary: 'Korean History',
image: '/assets/images/koreanHistory.jpg',
},
];
let storedData = localStorage.getItem('bookArray');
if (!storedData) {
localStorage.setItem('bookArray', JSON.stringify(initialBooks));
storedData = JSON.stringify(initialBooks);
}
let bookArray = JSON.parse(storedData);