-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* adding rating components * adding comments to the recipe sections * adding material UI * getting the basic rating system working * adding username * fixing issues * cleaning up the basics of the comments section * removing material UI * use raw HTML to set recipe comments * removing bad error catching * updating tests
- Loading branch information
Showing
24 changed files
with
436 additions
and
232 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import RC from '../constants/RatingsConstants' | ||
import {request} from "../../common/CustomSuperagent"; | ||
import {serverURLs} from "../../common/config"; | ||
|
||
export const load = (recipeSlug) => { | ||
return (dispatch) => { | ||
request() | ||
.get(serverURLs.ratings + "?recipe__slug=" + recipeSlug) | ||
.then(res => dispatch({ | ||
type: RC.LOAD, | ||
recipeSlug: recipeSlug, | ||
data: res.body.results, | ||
})) | ||
} | ||
}; | ||
|
||
export const remove = (id, recipeSlug) => { | ||
return (dispatch) => { | ||
request() | ||
.delete(serverURLs.ratings + id + '/') | ||
.then(res => dispatch({ | ||
type: RC.DELETE, | ||
id: id, | ||
recipe: recipeSlug, | ||
})) | ||
} | ||
}; | ||
|
||
export const add = (rating, comment, recipeSlug, userId) => { | ||
return dispatch => { | ||
request() | ||
.post(serverURLs.ratings) | ||
.send({ | ||
rating: rating, | ||
comment: comment, | ||
recipe: recipeSlug, | ||
author: userId, | ||
}) | ||
.then(res => dispatch({ | ||
type: RC.ADD, | ||
id: res.body.id, | ||
recipe: recipeSlug, | ||
comment: comment, | ||
username: res.body.username, | ||
rating: parseInt(rating, 10) | ||
})) | ||
} | ||
}; |
Oops, something went wrong.