You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There should be no errors on the console at all in your main working branch!
I shouldn't be able to see a delete button if i'm not meant to be able to? AM I meant to be able to update a story too?
Client-Side
actions
All promises need to have error handling. Add a .catch() to all thunk actions.
apis
In the stories file, you have return res.body but no promise to get res from!
This is duplicate code, move it to a utils file and then import where needed!
function logError(err) {
if (err.response.text === 'Username Taken') {
throw new Error('Username already taken - please choose another')
} else if (err.message === 'Forbidden') {
throw new Error(
'Only the user who added the story may update and delete it'
)
} else {
// eslint-disable-next-line no-console
console.error('Error consuming the API (in client/api.js):', err.message)
throw err
}
}
components
There are multiple empty lines in your components. Use a linter and at one have one empty line to break up code max.
If you have Te Reo for some of your options, why not all?
You have no value for some of your inputs. They should have values.
Home.tsx, should use react-router-dom's Link component instead of <a href=''/>.
This should be a button, it is doing an action (the onClick) rather than just linking, have the onClick function navigate after completing the action behaviour. Links navigate you to different pages that is not the default behaviour of interacting with this text. Users expect an action.
<Link className="navLink" to="/" onClick={handleLogOff}>
Log off
</Link>
There is a lot of commented out code and unused funcs in this component. Please tidy up for in use code only.
You have broken code in Story.tsx:
<button onClick={() => navigate('/stories/{story.id}/update')}>
Update Story
</button>
Do you sometime lose one region? Meaning you need a check on each individual region?
<option value={allRegions[4]?.id}>Auckland</option>
<option value={allRegions[5]?.id}>Waikato</option>
<option value={allRegions[6]?.id}>Bay of Plenty</option>
<option value={allRegions[7]?.id}>Gisborne</option>
Perhaps you could just check the array exists/has a length before rendering options instead?
Errors
Variable/property errors in Map.tsx, actions/regions.js, and reducers/search.js.
Server-Side
db
There is a file fruits.js that has stories stuff in it? Should this be deleted? Renamed?
Remove unused/commented out code
Secrets should be in an .env file! (and not pushed up to GitHub!)
You've exposed your secret key so you'll need to get a new one and make sure it's not exposed!
The text was updated successfully, but these errors were encountered:
localhost:3000
Client-Side
actions
.catch()
to all thunk actions.apis
return res.body
but no promise to get res from!components
value
for some of your inputs. They should have values.Home.tsx
, should usereact-router-dom
'sLink
component instead of<a href=''/>
.onClick
functionnavigate
after completing the action behaviour. Links navigate you to different pages that is not the default behaviour of interacting with this text. Users expect an action.Story.tsx
:Perhaps you could just check the array exists/has a length before rendering options instead?
Errors
Map.tsx
,actions/regions.js
, andreducers/search.js
.Server-Side
db
fruits.js
that has stories stuff in it? Should this be deleted? Renamed?Secrets should be in an .env file! (and not pushed up to GitHub!)
The text was updated successfully, but these errors were encountered: