Skip to content

Commit

Permalink
Merge pull request #31 from weaponsforge/dev
Browse files Browse the repository at this point in the history
v1.0.2
  • Loading branch information
weaponsforge authored Aug 25, 2022
2 parents e79abcd + 905c4d3 commit 3e9f8d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions client/components/todo/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,23 @@ function ViewTodo () {
<AppCard>
<h1>Todo Item</h1>

<Box sx={{ height: 400, width: '100%', textAlign: 'left' }}>
<Box sx={{ minHeight: 400, width: '100%', textAlign: 'left' }}>
{(loading === 'pending')
? <AppLoading />
: (error !== '')
? <Typography variant='caption' sx={{ color: 'red' }}>
{error}
</Typography>
: <Box>
{Object.keys(titles).map((key, index) => (
{Object.keys(titles).map((field, index) => (
<Box sx={{ display: 'flex' }} key={index}>
<Typography variant='subtitle2'>{titles[key]}: &nbsp;</Typography>
<Typography variant='subtitle2'>
{titles[field]}: &nbsp;
</Typography>
<span>
{['createdAt', 'updatedAt'].includes(key)
? new Date(todo[key]).toDateString()
: todo[key]
{['createdAt', 'updatedAt'].includes(field)
? new Date(todo[field]).toDateString()
: todo[field]
}
</span>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions client/store/todo/todoSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const todoSlice = createSlice({
loading: 'idle',
currentRequestId: null,
error: '',
todo: null
todo: {}
}),
reducers: {
todosLoading (state, action) {
Expand Down Expand Up @@ -81,7 +81,7 @@ const todoSlice = createSlice({
state.loading = 'pending'
state.currentRequestId = action.meta.requestId
state.error = ''
state.todo = null
state.todo = {}
}
})

Expand Down

0 comments on commit 3e9f8d5

Please sign in to comment.