forked from Abhay-N-J/NotO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.js
48 lines (47 loc) · 1.19 KB
/
data.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
45
46
47
48
var defaultThreads = [
{
id: 1,
title: "Thread 1",
author: "Adithya",
date: Date.now(),
content: "Thread content",
comments: [
{
author: "Adithya",
date: Date.now(),
content: "Hello"
},
{
author: "Abhiram",
date: Date.now(),
content: "Hello,how are you?"
}
]
},
{
id: 2,
title: "Thread 2",
author: "Adithya",
date: Date.now(),
content: "Thread content 2",
comments: [
{
author: "Adithya",
date: Date.now(),
content: "Hello"
},
{
author: "Abhiram",
date: Date.now(),
content: "Hello,how are you?"
}
]
}
]
var threads = defaultThreads
if (localStorage && localStorage.getItem('threads')) {
threads = JSON.parse(localStorage.getItem('threads'));
} else {
threads = defaultThreads;
localStorage.setItem('threads', JSON.stringify(defaultThreads));
}