@@ -86,10 +86,9 @@ const api = {
8686 }
8787 } ,
8888
89- category : {
90- get : async ( options ) => {
91- const { name } = options
92- const response = await fetch ( `/api/category/${ encodeURI ( name ) } ` , {
89+ settings : {
90+ get : async ( ) => {
91+ const response = await fetch ( '/api/settings' , {
9392 method : 'get' ,
9493 headers : {
9594 'content-type' : 'application/json'
@@ -98,9 +97,9 @@ const api = {
9897 return response . json ( )
9998 } ,
10099
101- create : async ( options ) => {
102- const response = await fetch ( '/api/category ' , {
103- method : 'put ' ,
100+ update : async ( options ) => {
101+ const response = await fetch ( '/api/settings ' , {
102+ method : 'post ' ,
104103 headers : {
105104 'content-type' : 'application/json'
106105 } ,
@@ -110,21 +109,9 @@ const api = {
110109 }
111110 } ,
112111
113- collections : {
114- get : async ( ) => {
115- const response = await fetch ( '/api/collections' , {
116- method : 'get' ,
117- headers : {
118- 'content-type' : 'application/json'
119- }
120- } )
121- return response . json ( )
122- }
123- } ,
124-
125- categories : {
112+ contentTypes : {
126113 get : async ( ) => {
127- const response = await fetch ( '/api/categories ' , {
114+ const response = await fetch ( '/api/contentTypes ' , {
128115 method : 'get' ,
129116 headers : {
130117 'content-type' : 'application/json'
@@ -146,9 +133,9 @@ const api = {
146133 }
147134 } ,
148135
149- contentTypes : {
136+ fileSystemTree : {
150137 get : async ( ) => {
151- const response = await fetch ( '/api/contentTypes ' , {
138+ const response = await fetch ( '/api/fileSystemTree ' , {
152139 method : 'get' ,
153140 headers : {
154141 'content-type' : 'application/json'
@@ -158,9 +145,9 @@ const api = {
158145 }
159146 } ,
160147
161- fileSystemTree : {
148+ collections : {
162149 get : async ( ) => {
163- const response = await fetch ( '/api/fileSystemTree ' , {
150+ const response = await fetch ( '/api/collections ' , {
164151 method : 'get' ,
165152 headers : {
166153 'content-type' : 'application/json'
@@ -193,66 +180,6 @@ const api = {
193180 }
194181 } ,
195182
196- post : {
197- get : async ( options ) => {
198- const query = makeQueryString ( options )
199- const queryString = query ? `?${ query } ` : ''
200- const response = await fetch ( `/api/post/${ queryString } ` , {
201- method : 'get' ,
202- headers : {
203- 'content-type' : 'application/json'
204- }
205- } )
206- return response . json ( )
207- } ,
208-
209- create : async ( options ) => {
210- const response = await fetch ( '/api/post' , {
211- method : 'put' ,
212- headers : {
213- 'content-type' : 'application/json'
214- } ,
215- body : JSON . stringify ( options )
216- } )
217- return response . json ( )
218- }
219- } ,
220-
221- posts : {
222- get : async ( ) => {
223- const response = await fetch ( '/api/posts' , {
224- method : 'get' ,
225- headers : {
226- 'content-type' : 'application/json'
227- }
228- } )
229- return response . json ( )
230- }
231- } ,
232-
233- settings : {
234- get : async ( ) => {
235- const response = await fetch ( '/api/settings' , {
236- method : 'get' ,
237- headers : {
238- 'content-type' : 'application/json'
239- }
240- } )
241- return response . json ( )
242- } ,
243-
244- update : async ( options ) => {
245- const response = await fetch ( '/api/settings' , {
246- method : 'post' ,
247- headers : {
248- 'content-type' : 'application/json'
249- } ,
250- body : JSON . stringify ( options )
251- } )
252- return response . json ( )
253- }
254- } ,
255-
256183 subpage : {
257184 get : async ( options ) => {
258185 const query = makeQueryString ( options )
@@ -288,32 +215,6 @@ const api = {
288215 } )
289216 return response . json ( )
290217 }
291- } ,
292-
293- tag : {
294- get : async ( options ) => {
295- const query = makeQueryString ( options )
296- const queryString = query ? `?${ query } ` : ''
297- const response = await fetch ( `/api/tag/${ queryString } ` , {
298- method : 'get' ,
299- headers : {
300- 'content-type' : 'application/json'
301- }
302- } )
303- return response . json ( )
304- }
305- } ,
306-
307- tags : {
308- get : async ( ) => {
309- const response = await fetch ( '/api/tags' , {
310- method : 'get' ,
311- headers : {
312- 'content-type' : 'application/json'
313- }
314- } )
315- return response . json ( )
316- }
317218 }
318219}
319220
0 commit comments