Skip to content

Commit dde9231

Browse files
authored
Merge pull request #37 from IFB-ElixirFr/comment
correct
2 parents c63d810 + c8f7385 commit dde9231

File tree

1 file changed

+71
-54
lines changed

1 file changed

+71
-54
lines changed

stores/useCommandStore.ts

Lines changed: 71 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,71 @@
1-
import { defineStore } from 'pinia'
2-
3-
4-
export const useCommandStore = defineStore('commandStore', () => {
5-
const command = ref(null)
6-
const changed = ref(false)
7-
8-
const changedTest = ref(false)
9-
const resultTest = ref(null)
10-
const resultTestChanged = ref(false)
11-
const testID = ref(null)
12-
13-
async function updateCommand(newCommand) {
14-
command.value = newCommand
15-
changed.value = true
16-
}
17-
18-
function setResultTest(result) {
19-
resultTest.value = result;
20-
resultTestChanged.value = true;
21-
}
22-
23-
async function updateCommandTest(newCommand, id) {
24-
command.value = newCommand
25-
changedTest.value = true
26-
testID.value = id;
27-
}
28-
29-
function reset() {
30-
command.value = null;
31-
changed.value = false;
32-
33-
changedTest.value = false;
34-
resultTestChanged.value = false;
35-
resultTest.value = null;
36-
testID.value = null;
37-
}
38-
39-
return {
40-
// States
41-
command,
42-
changed,
43-
changedTest,
44-
resultTest,
45-
resultTestChanged,
46-
testID,
47-
// Functions
48-
reset,
49-
updateCommand,
50-
updateCommandTest,
51-
setResultTest
52-
53-
}
54-
})
1+
import { defineStore } from "pinia";
2+
3+
export const useCommandStore = defineStore("commandStore", () => {
4+
const command = ref(null);
5+
const changed = ref(false);
6+
7+
const changedTest = ref(false);
8+
const resultTest = ref(null);
9+
const resultTestChanged = ref(false);
10+
const testID = ref(null);
11+
12+
async function updateCommand(newCommand) {
13+
command.value = newCommand;
14+
changed.value = true;
15+
}
16+
17+
/**
18+
* The function `setResultTest` sets the value of `resultTest` and changes the
19+
* value of `resultTestChanged` to true.
20+
* @param result - The `result` parameter is a value that will be assigned to
21+
* the `resultTest` variable.
22+
*/
23+
function setResultTest(result) {
24+
resultTest.value = result;
25+
resultTestChanged.value = true;
26+
}
27+
28+
/**
29+
* The function `updateCommandTest` updates the command value, sets the
30+
* changedTest value to true, and assigns a new test ID.
31+
* @param newCommand - The `newCommand` parameter in the `updateCommandTest`
32+
* function is the new value that will be assigned to the `command.value`
33+
* variable.
34+
* @param id - The `id` parameter in the `updateCommandTest` function is used
35+
* to specify the identifier of the test that you want to update with the new
36+
* command. It helps to uniquely identify the test that needs to be modified.
37+
*/
38+
async function updateCommandTest(newCommand, id) {
39+
command.value = newCommand;
40+
changedTest.value = true;
41+
testID.value = id;
42+
}
43+
44+
/**
45+
* The `reset` function sets various values to their initial state.
46+
*/
47+
function reset() {
48+
command.value = null;
49+
changed.value = false;
50+
51+
changedTest.value = false;
52+
resultTestChanged.value = false;
53+
resultTest.value = null;
54+
testID.value = null;
55+
}
56+
57+
return {
58+
// States
59+
command,
60+
changed,
61+
changedTest,
62+
resultTest,
63+
resultTestChanged,
64+
testID,
65+
// Functions
66+
reset,
67+
updateCommand,
68+
updateCommandTest,
69+
setResultTest,
70+
};
71+
});

0 commit comments

Comments
 (0)