Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
react-rails-rspec
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Aman Sharma
react-rails-rspec
Commits
56adfb10
Commit
56adfb10
authored
Oct 01, 2020
by
Aman Sharma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added file and server
parent
e0e4d1c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
recipes_controller.rb
app/controllers/api/v1/recipes_controller.rb
+2
-3
NewRecipe.jsx
app/javascript/components/NewRecipe.jsx
+2
-1
No files found.
app/controllers/api/v1/recipes_controller.rb
View file @
56adfb10
...
@@ -34,9 +34,8 @@ class Api::V1::RecipesController < ApplicationController
...
@@ -34,9 +34,8 @@ class Api::V1::RecipesController < ApplicationController
name
=
doc
.
search
(
'NAME'
).
text
name
=
doc
.
search
(
'NAME'
).
text
ingredients
=
doc
.
search
(
'INGREDIENTS'
).
text
ingredients
=
doc
.
search
(
'INGREDIENTS'
).
text
instruction
=
doc
.
search
(
'INSTRUCTION'
).
text
instruction
=
doc
.
search
(
'INSTRUCTION'
).
text
Recipe
.
create!
(
name:
name
,
ingredients:
ingredients
,
instruction:
instruction
)
recipe
=
Recipe
.
create!
(
name:
name
,
ingredients:
ingredients
,
instruction:
instruction
)
# Recipe.create!(recipe_params)
render
json:
recipe
render
json:
{
msg:
'OK'
}
end
end
private
private
...
...
app/javascript/components/NewRecipe.jsx
View file @
56adfb10
...
@@ -116,7 +116,8 @@ class NewRecipe extends React.Component {
...
@@ -116,7 +116,8 @@ class NewRecipe extends React.Component {
.
then
(
response
=>
{
.
then
(
response
=>
{
if
(
response
.
ok
)
{
if
(
response
.
ok
)
{
alert
(
"AAAAAAAAAAA"
)
alert
(
"AAAAAAAAAAA"
)
return
response
.
json
();
// return response.json();
console
.
log
(
response
.
json
);
}
}
throw
new
Error
(
"Network response was not ok."
);
throw
new
Error
(
"Network response was not ok."
);
})
})
...
...
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