Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
go
Commits
ec65da65
Commit
ec65da65
authored
Jan 07, 2019
by
David Haynes
🙆
Browse files
Add DebugDelete
parent
c84a05ae
Pipeline
#3586
passed with stage
in 1 minute and 11 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
go/go_ahead/src/Components/Molecules/DebugCreate.jsx
View file @
ec65da65
...
...
@@ -28,7 +28,9 @@ const DebugCreate = () => (
"
X-CSRFToken
"
:
GetCSRFToken
()
},
body
:
JSON
.
stringify
(
values
)
}).
then
(
response
=>
console
.
log
(
response
));
})
.
then
(
response
=>
console
.
log
(
response
))
.
then
(
setSubmitting
(
false
));
}
}
render
=
{
({
isSubmitting
})
=>
(
<
Form
>
...
...
go/go_ahead/src/Components/Molecules/DebugDelete.jsx
0 → 100644
View file @
ec65da65
import
React
from
"
react
"
;
import
*
as
Yup
from
"
yup
"
;
import
{
GetCSRFToken
}
from
"
../../Utils
"
;
import
{
Formik
,
Field
,
Form
,
ErrorMessage
}
from
"
formik
"
;
const
DebugDeleteYup
=
Yup
.
object
().
shape
({
short
:
Yup
.
string
()
.
required
(
"
Required
"
)
.
max
(
20
,
"
Too Long!
"
)
});
const
DebugDelete
=
()
=>
(
<
div
>
<
Formik
initialValues
=
{
{
short
:
""
}
}
validationSchema
=
{
DebugDeleteYup
}
onSubmit
=
{
(
values
,
{
setSubmitting
})
=>
{
const
deleteURL
=
"
/api/golinks/
"
+
values
.
short
;
fetch
(
deleteURL
,
{
method
:
"
delete
"
,
headers
:
{
"
Content-Type
"
:
"
application/json
"
,
"
X-CSRFToken
"
:
GetCSRFToken
()
}
})
.
then
(
response
=>
console
.
log
(
response
))
.
then
(
setSubmitting
(
false
));
}
}
render
=
{
({
isSubmitting
})
=>
(
<
Form
>
{
"
Short:
"
}
<
Field
name
=
"short"
/>
<
ErrorMessage
name
=
"short"
/>
<
button
type
=
"submit"
disabled
=
{
isSubmitting
}
>
Submit
</
button
>
</
Form
>
)
}
/>
</
div
>
);
export
default
DebugDelete
;
go/go_ahead/src/Components/Molecules/index.js
View file @
ec65da65
import
AuthButton
from
"
./AuthButton
"
;
import
DebugRead
from
"
./DebugRead
"
;
import
DebugCreate
from
"
./DebugCreate
"
;
import
DebugDelete
from
"
./DebugDelete
"
;
export
{
AuthButton
,
DebugRead
,
DebugCreate
};
export
{
AuthButton
,
DebugRead
,
DebugCreate
,
DebugDelete
};
go/go_ahead/src/Components/Pages/DebugCRUD.jsx
View file @
ec65da65
import
React
from
"
react
"
;
import
{
PageTemplate
,
DebugRead
,
DebugCreate
}
from
"
Components
"
;
import
{
PageTemplate
,
DebugRead
,
DebugCreate
,
DebugDelete
}
from
"
Components
"
;
class
DebugCRUD
extends
React
.
Component
{
constructor
(
props
)
{
...
...
@@ -21,6 +21,7 @@ class DebugCRUD extends React.Component {
<
h3
>
Update
</
h3
>
<
h3
>
Delete
</
h3
>
<
DebugDelete
/>
</
div
>
</
PageTemplate
>
);
...
...
go/go_ahead/src/Components/index.js
View file @
ec65da65
import
{
AuthButton
,
DebugRead
,
DebugCreate
}
from
"
./Molecules
"
;
import
{
AuthButton
,
DebugRead
,
DebugCreate
,
DebugDelete
}
from
"
./Molecules
"
;
import
{
NavBar
}
from
"
./Organisms
"
;
import
{
HomePage
,
AboutPage
,
DhaynesPage
,
DebugCRUD
}
from
"
./Pages
"
;
import
{
PageTemplate
}
from
"
./Templates
"
;
...
...
@@ -8,6 +8,7 @@ export {
AuthButton
,
DebugRead
,
DebugCreate
,
DebugDelete
,
//Organisms
NavBar
,
//Pages
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment