-
Notifications
You must be signed in to change notification settings - Fork 3
cors header #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
cors header #32
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,15 +3,17 @@ const mongo = require('src/databases/mongo') | |
| const NotFoundError = require('src/errors/not-found') | ||
|
|
||
| module.exports = async (language, signed) => { | ||
| const translationData = { signed, spoken: null } | ||
| const signedProcessedText = await text.process(signed) | ||
|
|
||
| const translation = await retrieveData(language, 'translations', { signed: signedProcessedText.hash }) | ||
|
|
||
| if (!translation) throw new NotFoundError() | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's important to keep this validation error.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case, shouldn't we just return no translation and let the backend handle this and show an alert to the user that no translation was found? As our database is still small, most phrases will return no translation.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the backend repo and |
||
| if (!translation) { | ||
| throw new NotFoundError() | ||
| } | ||
|
|
||
| const spoken = await retrieveData(language, 'spoken', { hash: translation.spoken }) | ||
|
|
||
| return { signed, spoken: spoken.text } | ||
| translationData.spoken = spoken ? spoken.text : null | ||
| return translationData | ||
| } | ||
|
|
||
| function retrieveData (language, collection, query) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of setting
ALLOWED_ORIGINSas mandatory, can we set it tohttp://localhost:3001by default and move the update instruction to the Customize section bellow?