1 | import { COMPONENT_TYPES, FORM_TYPES } from "../core/component-types";
|
2 | export const SEED_DATA = {
|
3 | name: "Fetch",
|
4 | tag: "Fetch",
|
5 | description: "Rest API Declarative Fetch component. Uses react-request internally",
|
6 | category: COMPONENT_TYPES.data,
|
7 | supports_list_render: false,
|
8 | layout: {},
|
9 | props: {
|
10 | url: {
|
11 | label: "URL",
|
12 | description: "The URL you want to fetch data from. You may have to add draftbit.com to your CORS setting",
|
13 | required: true,
|
14 | editable: true,
|
15 | type: FORM_TYPES.url
|
16 | },
|
17 | method: {
|
18 | label: "HTTP Method",
|
19 | description: "The HTTP method required to complete the request",
|
20 | required: true,
|
21 | editable: true,
|
22 | value: "GET",
|
23 | type: FORM_TYPES.flatArray,
|
24 | options: ["GET", "POST", "PUT", "PATCH", "DELETE"]
|
25 | },
|
26 | headers: {
|
27 | label: "HTTP Headers",
|
28 | description: "Any specific headers you have to add to complete the request.",
|
29 | required: false,
|
30 | editable: true,
|
31 | type: FORM_TYPES.json,
|
32 | value: JSON.stringify({
|
33 | "Content-type": "application/json",
|
34 | "Accept": "application/json"
|
35 | }, null, 2)
|
36 | },
|
37 | body: {
|
38 | label: "HTTP Body",
|
39 | description: "Any specific JSON body you have to add to complete the request.",
|
40 | required: false,
|
41 | editable: true,
|
42 | type: FORM_TYPES.json,
|
43 | value: null
|
44 | },
|
45 | mode: {
|
46 | label: "HTTP Mode",
|
47 | description: "The mode you want to use for the request",
|
48 | required: true,
|
49 | editable: true,
|
50 | value: null,
|
51 | type: FORM_TYPES.flatArray,
|
52 | options: ["cors", "no-cors", "same-origin"]
|
53 | },
|
54 | credentials: {
|
55 | label: "HTTP Credentials",
|
56 | description: "The credentials you want to use for the request",
|
57 | required: true,
|
58 | editable: true,
|
59 | value: null,
|
60 | type: FORM_TYPES.flatArray,
|
61 | options: ["omit", "same-origin", "include"]
|
62 | },
|
63 | lazy: {
|
64 | label: "Lazy Request",
|
65 | description: "Set this to true if you don't want to make the request initially",
|
66 | required: false,
|
67 | editable: true,
|
68 | value: null,
|
69 | type: FORM_TYPES.boolean
|
70 | },
|
71 | fetchPolicy: {
|
72 | label: "Fetch Policy",
|
73 | description: "Determines how the request interacts with the cache",
|
74 | editable: true,
|
75 | required: false,
|
76 | type: FORM_TYPES.flatArray,
|
77 | options: ["cache-first", "cache-and-network", "network-only", "cache-only"],
|
78 | value: null
|
79 | },
|
80 | loading: {
|
81 | label: "Loading Component",
|
82 | editable: true,
|
83 | required: false,
|
84 | type: FORM_TYPES.component,
|
85 | description: "Loading component to render until data shows up",
|
86 | value: null
|
87 | },
|
88 | error: {
|
89 | label: "Error Component",
|
90 | editable: true,
|
91 | required: false,
|
92 | type: FORM_TYPES.component,
|
93 | description: "Error component to render until data shows up",
|
94 | value: null
|
95 | }
|
96 | }
|
97 | };
|
98 |
|
\ | No newline at end of file |