Skip to content

Commit a63edcf

Browse files
committed
Add JSDoc comments
1 parent 14f2d65 commit a63edcf

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/store/index.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ interface Todo {
1717
}
1818
export default createStore({
1919
state: {
20-
//eslint-disable-next-line
20+
/**
21+
* The task with todos and user state data.
22+
*/
2123
todos: [] as Todo[],
2224
user: {
2325
level: 1 as number, //set level to 1 as total XP is 0 when state is created
@@ -32,6 +34,9 @@ export default createStore({
3234
},
3335
},
3436
getters: {
37+
/**
38+
* Getter methods for tasks with todos and user data.
39+
*/
3540
getTodos: (state) => state.todos, //get the task list
3641
getXp: (state) => state.user.xp, //get user XP
3742
getLevel: (state) => state.user.level, //get user level
@@ -618,10 +623,16 @@ export default createStore({
618623
}
619624
},
620625
setUser: (state, user) => {
626+
/**
627+
* Sets the user data.
628+
*/
621629
state.user = user; //set user data
622630
},
623631
setTodos: (state, todos) => {
624-
state.todos = todos; //set todos data
632+
/**
633+
* Sets the todos (tasks) data.
634+
*/
635+
state.todos = todos; //set todos (tasks) data
625636
},
626637
},
627638
actions: {

0 commit comments

Comments
 (0)