|
1 | | -# Action Creators |
2 | | -Actions are payloads of information that send data from the application to the store. |
| 1 | +--- |
| 2 | +title: Actions |
| 3 | +permalink: /frontend/actions/ |
| 4 | +description: Actions are payloads of information that send data from the application to the store. |
| 5 | +--- |
3 | 6 |
|
4 | 7 | ## Configuration |
5 | 8 |
|
6 | 9 | ### `fetchConfig` |
| 10 | + |
7 | 11 | Async action for fetching Jekyll project configuration (`_config.yml`) |
8 | 12 |
|
9 | 13 | ### `putConfig(config)` |
| 14 | + |
10 | 15 | Async action for updating Jekyll project configuration |
11 | 16 |
|
12 | 17 | ### `onEditorChange` |
13 | | -Action for notifying whether the YAML editor has changed after last update |
14 | 18 |
|
| 19 | +Action for notifying whether the YAML editor has changed after last update |
15 | 20 |
|
16 | 21 | ## Pages |
17 | 22 |
|
18 | 23 | ### `fetchPages` |
| 24 | + |
19 | 25 | Async action for fetching an array of page objects. |
20 | 26 |
|
21 | 27 | ### `fetchPage(id)` |
| 28 | + |
22 | 29 | Async action for fetching the requested page. |
23 | 30 |
|
24 | 31 | ### `putPage(id)` |
| 32 | + |
25 | 33 | Async action for creating/updating the requested page. The edited/new content comes |
26 | 34 | from `state.metadata` |
27 | 35 |
|
28 | 36 | ### `deletePage(id)` |
29 | | -Async action for deleting the requested page. |
30 | 37 |
|
| 38 | +Async action for deleting the requested page. |
31 | 39 |
|
32 | 40 | ## Collections |
33 | 41 |
|
34 | 42 | ### `fetchCollections` |
| 43 | + |
35 | 44 | Async action for fetching an array of the registered collections (including posts). |
36 | 45 |
|
37 | 46 | ### `fetchCollection(collection_name)` |
| 47 | + |
38 | 48 | Async action for fetching information about the requested collection |
39 | 49 |
|
40 | 50 | ### `fetchDocuments(collection_name)` |
| 51 | + |
41 | 52 | Async action for fetching an array of documents corresponding to the requested collection. The response does not include the document body. |
42 | 53 |
|
43 | 54 | ### `fetchDocument(collection_name, id)` |
| 55 | + |
44 | 56 | Async action for fetching the requested document. The response includes the document body. |
45 | 57 |
|
46 | 58 | ### `putDocument(id, collection_name)` |
| 59 | + |
47 | 60 | Async action for creating/updating the requested document. The response includes the document body. The updated content comes from `state.metadata` |
48 | 61 |
|
49 | 62 | ### `deleteDocument(collection_name, id)` |
50 | | -Async action for deleting the document from disk. |
51 | 63 |
|
| 64 | +Async action for deleting the document from disk. |
52 | 65 |
|
53 | 66 | ## Metadata |
54 | 67 |
|
55 | 68 | ### `storeContentFields(meta)` |
| 69 | + |
56 | 70 | Action that puts the current document's meta in the redux store. |
57 | 71 |
|
58 | 72 | ### `addField(namePrefix)` |
| 73 | + |
59 | 74 | Action that adds empty value to given path in metadata. |
60 | 75 |
|
61 | 76 | ### `removeField(namePrefix, key)` |
| 77 | + |
62 | 78 | Action that removes the field with the given `key`. `key` can be object key or |
63 | 79 | array index. |
64 | 80 |
|
65 | 81 | ### `updateFieldKey(namePrefix, fieldKey, newKey)` |
| 82 | + |
66 | 83 | Action that updates the key of the field with given path in metadata. |
67 | 84 |
|
68 | 85 | ### `updateFieldValue(nameAttr, value)` |
| 86 | + |
69 | 87 | Action that updates the value of the field with given path in metadata. |
70 | 88 |
|
71 | 89 | ### `moveArrayItem(namePrefix, srcInd, targetInd)` |
| 90 | + |
72 | 91 | Action that moves the array item of the field with given path in metadata |
73 | 92 | to the target index. |
74 | 93 |
|
75 | 94 | ### `convertField(nameAttr, convertType)` |
| 95 | + |
76 | 96 | Action that converts the field to the given type. |
77 | 97 |
|
78 | 98 | ### `updateTitle(title)` |
| 99 | + |
79 | 100 | Updates the content title when the input changes. |
80 | 101 |
|
81 | 102 | ### `updateBody(body)` |
| 103 | + |
82 | 104 | Updates the content body when the markdown editor changes. |
83 | 105 |
|
84 | 106 | ### `updatePath(path)` |
| 107 | + |
85 | 108 | Updates the content path when the input changes. |
86 | 109 |
|
87 | 110 | ### `updateDraft(isDraft)` |
88 | | -Updates the content visibility when the checkbox changes. |
89 | 111 |
|
| 112 | +Updates the content visibility when the checkbox changes. |
90 | 113 |
|
91 | 114 | ## Static Files |
92 | 115 |
|
93 | 116 | ### `fetchStaticFiles` |
| 117 | + |
94 | 118 | Async action for fetching static files. |
95 | 119 |
|
96 | 120 | ### `uploadStaticFiles(files)` |
| 121 | + |
97 | 122 | Async action for uploading multiple static files at the same time. |
98 | 123 | It encodes the uploaded `File` objects to `base64` before sending PUT request. |
99 | 124 |
|
100 | 125 | ### `deleteStaticFile(filename)` |
101 | | -Async action for deleting the requested static file. |
102 | 126 |
|
| 127 | +Async action for deleting the requested static file. |
103 | 128 |
|
104 | 129 | ## Data Files |
105 | 130 |
|
106 | 131 | ### `fetchDataFiles` |
| 132 | + |
107 | 133 | Async action for fetching data files. |
108 | 134 |
|
109 | 135 | ### `fetchDataFile(filename)` |
| 136 | + |
110 | 137 | Async action for fetching the requested data file. |
111 | 138 |
|
112 | 139 | ### `putDataFile(filename, data)` |
| 140 | + |
113 | 141 | Async action for creating/updating the requested data file. It validates the given filename and data before the PUT request. |
114 | 142 |
|
115 | 143 | ### `deleteDataFile(filename)` |
| 144 | + |
116 | 145 | Async action for deleting the requested data file. |
117 | 146 |
|
118 | 147 | ### `onDataFileChanged` |
119 | | -Action for keeping track of the updated form fields. |
120 | 148 |
|
| 149 | +Action for keeping track of the updated form fields. |
121 | 150 |
|
122 | 151 | ## Utils |
123 | 152 |
|
124 | 153 | ### `search(input)` |
| 154 | + |
125 | 155 | Action for storing search input from the user |
126 | 156 |
|
127 | 157 | ### `validationError(errors)` |
| 158 | + |
128 | 159 | Action for storing form errors. |
129 | 160 |
|
130 | 161 | ### `clearErrors` |
| 162 | + |
131 | 163 | Action for clearing form errors if any. |
0 commit comments