diff --git a/src/components/index/indexConsole/commands/fetchCommands/Album/Create.js b/src/components/index/indexConsole/commands/fetchCommands/Album/Create.js
index d494102..7db13d2 100644
--- a/src/components/index/indexConsole/commands/fetchCommands/Album/Create.js
+++ b/src/components/index/indexConsole/commands/fetchCommands/Album/Create.js
@@ -101,19 +101,19 @@ const AlbumCreate = ({
id='titleAlbumInput'
autoComplete='off'
ref={ titleInput }
- />
+ />
description:
+ />
image:
+ />
diff --git a/src/components/index/indexConsole/commands/fetchCommands/Album/GetAll.js b/src/components/index/indexConsole/commands/fetchCommands/Album/GetAll.js
index fea26eb..38b9d96 100644
--- a/src/components/index/indexConsole/commands/fetchCommands/Album/GetAll.js
+++ b/src/components/index/indexConsole/commands/fetchCommands/Album/GetAll.js
@@ -19,9 +19,9 @@ const AlbumGetAll = ({
let list = '.albums\n'
for (let i = 0; i < albums.length; i++) {
list += '├── ' + albums[i].title + '\n'
- + '│ ├── id: ' + albums[i].id + '\n'
- + '│ ├── user id: ' + albums[i].user_id + '\n'
- + '│ └── url: ' + albums[i].url_code + '\n'
+ + '│ ├── id: ' + albums[i].id + '\n'
+ + '│ ├── user id: ' + albums[i].user_id + '\n'
+ + '│ └── url: ' + albums[i].url_code + '\n'
}
return list
}
diff --git a/src/components/index/indexConsole/indexConsole.js b/src/components/index/indexConsole/indexConsole.js
index 4541591..51fe1ca 100644
--- a/src/components/index/indexConsole/indexConsole.js
+++ b/src/components/index/indexConsole/indexConsole.js
@@ -13,11 +13,8 @@ import AlbumDelete from './commands/fetchCommands/Album/Delete'
import '../../../styles/general.scss'
-import { deleteAuth } from '../../../stores/user/duck/operations'
-
const IndexConsole = ({
- user,
- deleteAuth
+ user
}) => {
const [consoleHistory, setConsoleHistory] = useState('')
@@ -60,27 +57,17 @@ const IndexConsole = ({
let inputValue = consoleInput.current.value
consoleUser += inputValue + '\n'
+ let splitCommand = inputValue.split(' ')
+ let choiceCRUD = splitCommand[ splitCommand.length - 1 ]
+
if ( user.username !== '' ) {
if ( inputValue === 'help' ){
setConsoleHistory( consoleHistory + consoleUser + commands.helpUser() )
} else if ( inputValue === 'logout' ) {
setConsoleHistory( consoleHistory + consoleUser )
setLogout( !logout )
- } else if ( inputValue === 'get all album') {
- setConsoleHistory( consoleHistory + consoleUser )
- setAlbumGetAll( !albumGetAll )
- } else if ( inputValue === 'get one album' ) {
- setConsoleHistory( consoleHistory + consoleUser )
- setAlbumGetOne( !albumGetOne )
- } else if ( inputValue === 'create album' ) {
- setConsoleHistory( consoleHistory + consoleUser )
- setAlbumCreate( !albumCreate )
- } else if ( inputValue === 'update album' ) {
- setConsoleHistory( consoleHistory + consoleUser )
- setAlbumUpdate( !albumUpdate )
- } else if ( inputValue === 'delete album' ) {
- setConsoleHistory( consoleHistory + consoleUser )
- setAlbumDelete( !albumDelete )
+ } else if ( choiceCRUD === 'album' ) {
+ albumCRUD( inputValue )
} else if ( inputValue === 'clean' ){
setConsoleHistory( '' )
} else {
@@ -104,6 +91,25 @@ const IndexConsole = ({
activateInput()
}
+ const albumCRUD = ( inputValue ) => {
+ if ( inputValue === 'get all album') {
+ setConsoleHistory( consoleHistory + consoleUser )
+ setAlbumGetAll( !albumGetAll )
+ } else if ( inputValue === 'get one album' ) {
+ setConsoleHistory( consoleHistory + consoleUser )
+ setAlbumGetOne( !albumGetOne )
+ } else if ( inputValue === 'create album' ) {
+ setConsoleHistory( consoleHistory + consoleUser )
+ setAlbumCreate( !albumCreate )
+ } else if ( inputValue === 'update album' ) {
+ setConsoleHistory( consoleHistory + consoleUser )
+ setAlbumUpdate( !albumUpdate )
+ } else if ( inputValue === 'delete album' ) {
+ setConsoleHistory( consoleHistory + consoleUser )
+ setAlbumDelete( !albumDelete )
+ }
+ }
+
const activateInput = () => {
document.getElementById('consoleInput').focus()
}
@@ -214,7 +220,6 @@ const mapStateToProps = state => ({
})
const mapDispatchToProps = dispatch => ({
- deleteAuth: (token) => dispatch( deleteAuth(token) )
})
export default connect(mapStateToProps, mapDispatchToProps)(IndexConsole)
\ No newline at end of file