ywana-core8 0.0.699 → 0.0.701
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +19 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.modern.js +19 -14
- package/dist/index.modern.js.map +1 -1
- package/dist/index.umd.js +19 -13
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/domain/CollectionAPI.js +0 -2
- package/src/domain/CollectionPage.js +3 -1
- package/src/domain/CollectionPage2.js +0 -0
- package/src/domain2/CollectionAPI.js +83 -0
- package/src/domain2/CollectionAPI.test.js +19 -0
- package/src/domain2/CollectionContext.js +160 -0
- package/src/domain2/CollectionContext.test.js +58 -0
- package/src/domain2/CollectionEditor.js +17 -0
- package/src/domain2/CollectionFilters.css +50 -0
- package/src/domain2/CollectionFilters.js +71 -0
- package/src/domain2/CollectionList.js +30 -0
- package/src/domain2/CollectionPage.css +36 -0
- package/src/domain2/CollectionPage.js +31 -0
- package/src/domain2/CollectionPage.test.js +88 -0
- package/src/domain2/CollectionQueries.js +10 -0
- package/src/domain2/DynamicForm.css +14 -0
- package/src/domain2/DynamicForm.js +82 -0
- package/src/domain2/DynamicForm.test.js +46 -0
- package/src/domain2/FORMATS.js +1 -1
- package/src/html/index.js +1 -1
- package/src/html/textfield.js +4 -1
- package/src/incubator/task.js +0 -2
- package/src/site/site.test.js +9 -8
- package/src/domain2/Content.js +0 -33
- package/src/domain2/ContentFilters.js +0 -74
- package/src/domain2/ContentPage.js +0 -96
@@ -0,0 +1,88 @@
|
|
1
|
+
import React, { useContext, useEffect, useState } from 'react'
|
2
|
+
import { CheckBox } from '../html'
|
3
|
+
import { CollectionContext } from './CollectionContext'
|
4
|
+
import { CollectionPage } from './CollectionPage'
|
5
|
+
|
6
|
+
const CollectionPageTest = (prop) => {
|
7
|
+
|
8
|
+
const schema = [
|
9
|
+
{ id: "id", type: "string", label: "ID" },
|
10
|
+
{ id: "name", type: "string", label: "Name", filter: true },
|
11
|
+
{ id: "gender", type: "string", label: "Gender", filter: true, options: [
|
12
|
+
{ label: "Masculine", value: 1 },
|
13
|
+
{ label: "Feminine", value: 0 }
|
14
|
+
]},
|
15
|
+
]
|
16
|
+
|
17
|
+
const props = {
|
18
|
+
host: "http://localhost:3000",
|
19
|
+
url: "/references",
|
20
|
+
schema,
|
21
|
+
layout: "ide",
|
22
|
+
canFilter: true,
|
23
|
+
customFilters: [<CustomFilter1 />,<CustomFilter2 />]
|
24
|
+
}
|
25
|
+
|
26
|
+
return (
|
27
|
+
<>
|
28
|
+
<CollectionPage {...props} />
|
29
|
+
</>
|
30
|
+
)
|
31
|
+
}
|
32
|
+
|
33
|
+
const CustomFilter1 = (props) => {
|
34
|
+
|
35
|
+
const context = useContext(CollectionContext)
|
36
|
+
const [active, setActive] = useState(false)
|
37
|
+
|
38
|
+
useEffect(() => {
|
39
|
+
if (active) {
|
40
|
+
context.addCustomFilter("custom1", filter)
|
41
|
+
} else {
|
42
|
+
context.removeCustomFilter("custom1")
|
43
|
+
}
|
44
|
+
}, [active])
|
45
|
+
|
46
|
+
function change(id, value) {
|
47
|
+
setActive(value)
|
48
|
+
}
|
49
|
+
|
50
|
+
function filter(all) {
|
51
|
+
return all.filter(item => {
|
52
|
+
return item.name.startsWith("1")
|
53
|
+
})
|
54
|
+
}
|
55
|
+
|
56
|
+
return (
|
57
|
+
<CheckBox id="custom1" value={active} label="Active" onChange={change}/>
|
58
|
+
)
|
59
|
+
}
|
60
|
+
|
61
|
+
const CustomFilter2 = (props) => {
|
62
|
+
|
63
|
+
const { value = false } = props
|
64
|
+
const context = useContext(CollectionContext)
|
65
|
+
const [active, setActive] = useState(value)
|
66
|
+
|
67
|
+
useEffect(() => {
|
68
|
+
if (active) {
|
69
|
+
context.addCustomFilter("custom2", filter)
|
70
|
+
} else {
|
71
|
+
context.removeCustomFilter("custom2")
|
72
|
+
}
|
73
|
+
}, [active])
|
74
|
+
|
75
|
+
function change(id, value) {
|
76
|
+
setActive(value)
|
77
|
+
}
|
78
|
+
|
79
|
+
function filter(all) {
|
80
|
+
return all.filter(item => {
|
81
|
+
return item.name.endsWith("1")
|
82
|
+
})
|
83
|
+
}
|
84
|
+
|
85
|
+
return (
|
86
|
+
<CheckBox id="custom1" value={active} label="Locked" onChange={change}/>
|
87
|
+
)
|
88
|
+
}
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { CheckBox, ColorField, DateRange, DropDown, TextField, TokenField } from '../html'
|
3
|
+
import { FORMATS } from './FORMATS'
|
4
|
+
import './DynamicForm.css'
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Dynamic Form
|
8
|
+
*/
|
9
|
+
export const DynamicForm = (props) => {
|
10
|
+
const { schema, values, onChange } = props
|
11
|
+
|
12
|
+
function change(id, value) {
|
13
|
+
if (onChange) onChange(id, value)
|
14
|
+
}
|
15
|
+
|
16
|
+
return (
|
17
|
+
<div className="dynamic-form">
|
18
|
+
{schema.map(field => {
|
19
|
+
const { id, label, type } = field
|
20
|
+
return (
|
21
|
+
<DynamicFormField key={id} field={field} value={values[id]} onChange={change} />
|
22
|
+
)
|
23
|
+
})}
|
24
|
+
</div>
|
25
|
+
)
|
26
|
+
}
|
27
|
+
|
28
|
+
/**
|
29
|
+
* Dynamic Form Field
|
30
|
+
*/
|
31
|
+
const DynamicFormField = (props) => {
|
32
|
+
|
33
|
+
const { field, value, onChange } = props
|
34
|
+
const { id, type, format, options, required } = field
|
35
|
+
|
36
|
+
function change(id, value) {
|
37
|
+
if (onChange) onChange(id, value)
|
38
|
+
}
|
39
|
+
|
40
|
+
function buildOptions() {
|
41
|
+
if (typeof options === "function") {
|
42
|
+
return options()
|
43
|
+
}
|
44
|
+
return options
|
45
|
+
}
|
46
|
+
|
47
|
+
function renderByFormat() {
|
48
|
+
|
49
|
+
const label = required ? `${field.label} *` : field.label
|
50
|
+
|
51
|
+
switch (format) {
|
52
|
+
case FORMATS.DATE:
|
53
|
+
return <TextField id={id} label={label} type="date" value={value} onChange={change} outlined />
|
54
|
+
case FORMATS.TIME:
|
55
|
+
return <TextField id={id} label={label} type="time" value={value} onChange={change} outlined />
|
56
|
+
case FORMATS.DATERANGE:
|
57
|
+
return <DateRange id={id} label={label} value={value} onChange={change} />
|
58
|
+
case FORMATS.TOKENS:
|
59
|
+
return <TokenField id={id} label={label} onChange={change} options={buildOptions()} tokens={value} />
|
60
|
+
case FORMATS.COLOR:
|
61
|
+
return <ColorField id={id} onChange={change} value={value} />
|
62
|
+
default:
|
63
|
+
return options ? <DropDown id={id} label={label} value={value} onChange={change} options={options} outlined/> :
|
64
|
+
<TextField id={id} label={label} value={value} onChange={change} outlined />
|
65
|
+
}
|
66
|
+
}
|
67
|
+
|
68
|
+
function renderByType() {
|
69
|
+
switch (type) {
|
70
|
+
case "boolean":
|
71
|
+
return <CheckBox id={id} label={field.label} value={value} onChange={change} />
|
72
|
+
default:
|
73
|
+
return renderByFormat()
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
return (
|
78
|
+
<div className="dynamic-form-field">
|
79
|
+
{renderByType()}
|
80
|
+
</div>
|
81
|
+
)
|
82
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { DynamicForm } from './DynamicForm'
|
3
|
+
import { FORMATS } from './FORMATS'
|
4
|
+
|
5
|
+
const DynamicFormTest = (props) => {
|
6
|
+
|
7
|
+
const config = {
|
8
|
+
host: "http://localhost:3000",
|
9
|
+
url: "/references",
|
10
|
+
}
|
11
|
+
|
12
|
+
const style = {
|
13
|
+
display: "flex",
|
14
|
+
flexDirection: "row",
|
15
|
+
}
|
16
|
+
|
17
|
+
const schema = [
|
18
|
+
{ id: "id", type: "string", label: "ID" },
|
19
|
+
{ id: "name", type: "string", label: "Name", filter: true, like: true },
|
20
|
+
{ id: "gender", type: "string", label: "Gender", filter: true, options: [
|
21
|
+
{ label: "Masculine", value: 1 },
|
22
|
+
{ label: "Feminine", value: 0 }
|
23
|
+
]},
|
24
|
+
{ id: "initDate", type: "string", label: "Init Date", format: FORMATS.DATE },
|
25
|
+
{ id: "hour", type: "string", label: "Hour", format: FORMATS.TIME},
|
26
|
+
{ id: "range", type: "string", label: "Range", format: FORMATS.DATERANGE },
|
27
|
+
{ id:"email", type: "string", label: "Email", format: FORMATS.EMAIL },
|
28
|
+
{ id: "color", type: "string", label: "Color", format: FORMATS.COLOR },
|
29
|
+
{ id: "active", type: "boolean", label: "Active", format: FORMATS.CHECKBOX },
|
30
|
+
]
|
31
|
+
|
32
|
+
const [values, setValues] = useState({})
|
33
|
+
|
34
|
+
function onChange(id, value) {
|
35
|
+
setValues({ ...values, [id]: value })
|
36
|
+
}
|
37
|
+
|
38
|
+
console.log(values)
|
39
|
+
|
40
|
+
return (
|
41
|
+
<div style={style}>
|
42
|
+
<DynamicForm schema={schema} values={values} onChange={onChange}/>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
)
|
46
|
+
}
|
package/src/domain2/FORMATS.js
CHANGED
package/src/html/index.js
CHANGED
@@ -14,7 +14,7 @@ export { Section } from './section'
|
|
14
14
|
export { Tabs, Tab, Stack } from './tab'
|
15
15
|
export { DataTable } from './table'
|
16
16
|
export { Text, TEXTFORMATS } from './text'
|
17
|
-
export { TextField, DropDown, TextArea } from './textfield'
|
17
|
+
export { TextField, DropDown, TextArea, DateRange } from './textfield'
|
18
18
|
export { TokenField } from './tokenfield'
|
19
19
|
export { Tree, TreeNode, TreeItem } from './tree'
|
20
20
|
export { Switch } from './switch'
|
package/src/html/textfield.js
CHANGED
@@ -203,7 +203,10 @@ export const DateRange = (props) => {
|
|
203
203
|
const [form, setForm] = useState({})
|
204
204
|
|
205
205
|
useEffect(() => {
|
206
|
-
if
|
206
|
+
// if form has changed
|
207
|
+
if (form && form.from && form.to) {
|
208
|
+
if (onChange) onChange(id, form)
|
209
|
+
}
|
207
210
|
}, [form])
|
208
211
|
|
209
212
|
function change(id, value) {
|
package/src/incubator/task.js
CHANGED
@@ -69,13 +69,11 @@ export const TaskContextProvider = (props) => {
|
|
69
69
|
listeners.splice(index, 1)
|
70
70
|
}
|
71
71
|
})
|
72
|
-
console.log("listeners after remove", listeners)
|
73
72
|
}
|
74
73
|
|
75
74
|
useEffect(() => {
|
76
75
|
const interval = setInterval(async () => {
|
77
76
|
const tasks = await API.all()
|
78
|
-
console.log(listeners)
|
79
77
|
listeners.forEach(({ taskId, listener }) => {
|
80
78
|
const task = tasks.find(task => task.id === taskId)
|
81
79
|
if (task) listener(task)
|
package/src/site/site.test.js
CHANGED
@@ -199,15 +199,15 @@ const Page5 = (props) => {
|
|
199
199
|
}
|
200
200
|
|
201
201
|
const schema = {
|
202
|
-
field6: { id: "field6", section: "C", type: TYPES.ARRAY , item: ENTITYTYPE , filter: false
|
203
|
-
name : { id: "name" , section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , like: true, label: "Name" },
|
204
|
-
state : { id: "state" , section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: true , grouper: true , column: true , filter: true
|
202
|
+
field6: { id: "field6", section: "C", type: TYPES.ARRAY , item: ENTITYTYPE , filter: false , label: "Collection 100"},
|
203
|
+
name : { id: "name" , section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , like: true , label: "Name" },
|
204
|
+
state : { id: "state" , section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: true , grouper: true , column: true , filter: true , label: "State" , options: [
|
205
205
|
{ label: "Pendiente", value: "NOT_CLASSIFIED" },
|
206
|
-
{ label: "Clasificada", value: "CLASSIFIED"},
|
206
|
+
{ label: "Clasificada", value: "CLASSIFIED" },
|
207
207
|
]},
|
208
|
-
field1: { id: "field1", section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true
|
209
|
-
field2: { id: "field2", section: "B", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true
|
210
|
-
field4: { id: "field4", section: "B", type: TYPES.STRING , format: FORMATS.COLOR, required: true, tab: false, grouper: true , column: true , filter: false
|
208
|
+
field1: { id: "field1", section: "A", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "field1" },
|
209
|
+
field2: { id: "field2", section: "B", type: TYPES.STRING , format: FORMATS.NONE , required: true, tab: false, grouper: true , column: true , filter: true , label: "field2" },
|
210
|
+
field4: { id: "field4", section: "B", type: TYPES.STRING , format: FORMATS.COLOR, required: true, tab: false, grouper: true , column: true , filter: false , label: "Color" },
|
211
211
|
field5: { id: "field5", section: "B", type: TYPES.ENTITY, item: ENTITYTYPE, format: FORMATS.NONE , editable: true, tab: false, grouper: false, column: true , filter: false, like: false, label: "Entity5"},
|
212
212
|
id : { id: "id" , type: TYPES.STRING , filter: false },
|
213
213
|
}
|
@@ -217,7 +217,8 @@ const Page5 = (props) => {
|
|
217
217
|
<CollectionPage
|
218
218
|
title="Referencias"
|
219
219
|
schema={schema} host="http://localhost:3000" url="/references" fetching={true} // resource
|
220
|
-
searchBy={["name"]} levels={["color"]}
|
220
|
+
searchBy={["name"]} levels={["color"]} // list
|
221
|
+
canFilter={true} filters={{ name: "111" }} // filters
|
221
222
|
editor="TABBED" canAdd={true} // editor
|
222
223
|
/>
|
223
224
|
</Fragment>
|
package/src/domain2/Content.js
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
import { FORMATS } from "./FORMATS";
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Content
|
5
|
-
*/
|
6
|
-
class Content {
|
7
|
-
|
8
|
-
constructor(schema, value) {
|
9
|
-
this.schema = schema;
|
10
|
-
this.value = value;
|
11
|
-
}
|
12
|
-
|
13
|
-
}
|
14
|
-
|
15
|
-
const ADDRESS_SCHEMA = {
|
16
|
-
id : { type: TYPES.STRING },
|
17
|
-
street : { type: TYPES.STRING, default: '' },
|
18
|
-
city : { type: TYPES.STRING, default: '' },
|
19
|
-
state : { type: TYPES.STRING, default: '' },
|
20
|
-
zip : { type: TYPES.STRING, default: '' },
|
21
|
-
country: { type: TYPES.STRING, default: '' },
|
22
|
-
}
|
23
|
-
|
24
|
-
const PERSON_SCHEMA = {
|
25
|
-
id : { type: TYPES.STRING },
|
26
|
-
name : { type: TYPES.STRING , format: FORMATS.NONE, label: 'Name' },
|
27
|
-
address : { type: TYPES.ENTITY, item: ADDRESS_SCHEMA, format: FORMATS.NONE, label: 'Address' },
|
28
|
-
age : { type: TYPES.NUMBER , format: FORMATS.NONE, label: 'Age' , default: 0 },
|
29
|
-
married : { type: TYPES.BOOLEAN , format: FORMATS.NONE, label: 'Married' , default: false },
|
30
|
-
children: { type: TYPES.ARRAY , item: TYPES.STRING , format: FORMATS.NONE, label: 'Children', default: [] },
|
31
|
-
}
|
32
|
-
|
33
|
-
const person = new Content(PERSON_SCHEMA, {})
|
@@ -1,74 +0,0 @@
|
|
1
|
-
export const ContentFilters = (props) => {
|
2
|
-
|
3
|
-
const [pageContext, setPageContext] = useContext(PageContext)
|
4
|
-
const { filters } = pageContext
|
5
|
-
const { schema, onSave } = props
|
6
|
-
const [form, setForm] = useState({})
|
7
|
-
|
8
|
-
const filterSchema = useMemo(() => {
|
9
|
-
const filterSchema = Object.assign({}, schema)
|
10
|
-
for (var key in filterSchema) {
|
11
|
-
if (filterSchema[key].filter === false) {
|
12
|
-
delete filterSchema[key]
|
13
|
-
} else {
|
14
|
-
if (filterSchema[key].type === TYPES.ENTITY) {
|
15
|
-
const fs = filterSchema[key].item
|
16
|
-
for (var key in fs) {
|
17
|
-
if (fs[key].filter === false) delete fs[key]
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
}
|
22
|
-
//Object.values(filterSchema).forEach(field => field.section = null)
|
23
|
-
delete filterSchema.flows
|
24
|
-
return filterSchema
|
25
|
-
}, [schema])
|
26
|
-
|
27
|
-
const likes = useMemo(() => {
|
28
|
-
const fields = Object.values(schema)
|
29
|
-
return fields.reduce((likes, field) => {
|
30
|
-
if (field.like === true) likes.push(field.id)
|
31
|
-
return likes
|
32
|
-
}, [])
|
33
|
-
}, [schema])
|
34
|
-
|
35
|
-
useEffect(() => {
|
36
|
-
if (filters) setForm(filters)
|
37
|
-
}, [filters])
|
38
|
-
|
39
|
-
useEffect(() => {
|
40
|
-
reload()
|
41
|
-
}, [form])
|
42
|
-
|
43
|
-
async function change(next) {
|
44
|
-
setForm(next)
|
45
|
-
}
|
46
|
-
|
47
|
-
async function reload() {
|
48
|
-
await pageContext.load(form, likes)
|
49
|
-
setPageContext(Object.assign({}, pageContext))
|
50
|
-
}
|
51
|
-
|
52
|
-
function clear() {
|
53
|
-
change({})
|
54
|
-
}
|
55
|
-
|
56
|
-
function save() {
|
57
|
-
if (onSave) {
|
58
|
-
onSave(form)
|
59
|
-
}
|
60
|
-
}
|
61
|
-
|
62
|
-
const content = new Content(filterSchema, form)
|
63
|
-
return (
|
64
|
-
<Fragment>
|
65
|
-
<Header className="table-filters" title={<Text>Filters</Text>} >
|
66
|
-
<Icon icon="filter_list_off" size="small" clickable action={clear} />
|
67
|
-
{onSave ? <Icon icon="save" size="small" clickable action={save} /> : null}
|
68
|
-
</Header>
|
69
|
-
<main className="table-filters">
|
70
|
-
<ContentEditor content={content} onChange={change} />
|
71
|
-
</main>
|
72
|
-
</Fragment>
|
73
|
-
)
|
74
|
-
}
|
@@ -1,96 +0,0 @@
|
|
1
|
-
export const ContentPage = (props) => {
|
2
|
-
|
3
|
-
const {
|
4
|
-
icon, title, className,
|
5
|
-
schema, url,
|
6
|
-
} = props
|
7
|
-
|
8
|
-
return (
|
9
|
-
<>
|
10
|
-
<header className="content-page"></header>
|
11
|
-
<nav className="content-page"></nav>
|
12
|
-
<menu className="content-page">
|
13
|
-
|
14
|
-
</menu>
|
15
|
-
<main className="content-page">
|
16
|
-
|
17
|
-
</main>
|
18
|
-
<aside className="content-page"></aside>
|
19
|
-
<footer className="content-page"></footer>
|
20
|
-
</>
|
21
|
-
)
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
/**
|
27
|
-
* Content API
|
28
|
-
*/
|
29
|
-
const ContentAPI = (url, host) => {
|
30
|
-
|
31
|
-
const http = HTTPClient(host || window.API || process.env.REACT_APP_API, Session);
|
32
|
-
|
33
|
-
return {
|
34
|
-
all(filters = [], likes = [], page) {
|
35
|
-
let queryParams = page ? `?page=${page}&` : "?"
|
36
|
-
const filterQuery = Object.keys(filters).reduce((query, key) => {
|
37
|
-
const value = filters[key]
|
38
|
-
if (typeof (value) === 'boolean') return query.concat(`${key}=${value}&`)
|
39
|
-
if (Array.isArray(value)) {
|
40
|
-
const param = value.length === 0 ? '' : value.reduce((param, item) => {
|
41
|
-
param = param.concat(`${key}=${item}&`)
|
42
|
-
return param
|
43
|
-
}, "")
|
44
|
-
return query.concat(param)
|
45
|
-
}
|
46
|
-
const likeSymbol = likes.includes(key) ? '%' : ''
|
47
|
-
return query.concat(`${key}=${likeSymbol}${value}${likeSymbol}&`)
|
48
|
-
}, "")
|
49
|
-
queryParams = queryParams.concat(filterQuery)
|
50
|
-
return http.GET(url + queryParams)
|
51
|
-
},
|
52
|
-
|
53
|
-
find(id) {
|
54
|
-
return http.GET(`${url}/${id}`)
|
55
|
-
},
|
56
|
-
|
57
|
-
create(form) {
|
58
|
-
const body = JSON.stringify(form)
|
59
|
-
return http.POST(url, body)
|
60
|
-
},
|
61
|
-
|
62
|
-
update(form) {
|
63
|
-
const body = JSON.stringify(form)
|
64
|
-
return http.PUT(`${url}/${form.id}`, body)
|
65
|
-
},
|
66
|
-
|
67
|
-
updateProperty(id, propertyName, form) {
|
68
|
-
const body = JSON.stringify(form)
|
69
|
-
return http.PUT(`${url}/${id}/${propertyName}`, body)
|
70
|
-
},
|
71
|
-
|
72
|
-
patch(id, form) {
|
73
|
-
const body = JSON.stringify(form)
|
74
|
-
return http.PATCH(`${url}/${id}`, body)
|
75
|
-
},
|
76
|
-
|
77
|
-
remove(id) {
|
78
|
-
return http.DELETE(`${url}/${id}`)
|
79
|
-
},
|
80
|
-
|
81
|
-
queries(user) {
|
82
|
-
const queryParams = user ? `?user=${user}` : ""
|
83
|
-
return http.GET(`/queries/${url}${queryParams}`)
|
84
|
-
},
|
85
|
-
|
86
|
-
createQuery(form) {
|
87
|
-
const body = JSON.stringify(form)
|
88
|
-
return http.POST(`/queries/${url}`, body)
|
89
|
-
},
|
90
|
-
|
91
|
-
removeQuery(id) {
|
92
|
-
return http.DELETE(`/queries/${url}/${id}`)
|
93
|
-
},
|
94
|
-
|
95
|
-
}
|
96
|
-
}
|