Skip to content

Commit

Permalink
feat: add errors components
Browse files Browse the repository at this point in the history
  • Loading branch information
Rue-pro committed Apr 8, 2024
1 parent c8b7b24 commit d17787a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/entities/error/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './ui'
export * from './model'
13 changes: 13 additions & 0 deletions src/entities/error/ui/ErrorCard/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { TBaseError } from '@shared/libs/operationResult'

interface Props {
error: TBaseError
}

export const ErrorCard = ({ error }: Props) => {
return (
<div>
Error {error.type} {error.error}
</div>
)
}
19 changes: 19 additions & 0 deletions src/entities/error/ui/ErrorList/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useStore } from '@nanostores/preact'

import { $errors } from '@entities/error/model/store'

import { ErrorCard } from '../ErrorCard'

export const ErrorList = () => {
const errors = useStore($errors)

return (
<ul>
<li>
{errors.map((error) => (
<ErrorCard error={error} />
))}
</li>
</ul>
)
}
1 change: 1 addition & 0 deletions src/entities/error/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ErrorList } from './ErrorList'

0 comments on commit d17787a

Please sign in to comment.