Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2021-090 frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2021-090
2021-090 frontend
Commits
3d36ff1c
Commit
3d36ff1c
authored
Nov 25, 2021
by
pramod.nichelabs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auction delete functionality added
parent
5f01fe02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
1 deletion
+31
-1
screen/User.Auctions.Screen.js
screen/User.Auctions.Screen.js
+31
-1
No files found.
screen/User.Auctions.Screen.js
View file @
3d36ff1c
...
...
@@ -6,6 +6,7 @@ import { AppContainer } from '../container/container';
import
themeColors
from
'
../assets/colors
'
;
import
{
AuctionBottomTab
}
from
'
../Navigations/AuctionBottomTab
'
;
import
{
MaterialIcons
}
from
'
@expo/vector-icons
'
;
import
Toast
from
'
react-native-root-toast
'
;
const
UserAuctionListScreen
=
({
navigation
})
=>
{
const
[
auctions
,
setAuctions
]
=
useState
([]);
...
...
@@ -19,6 +20,35 @@ const UserAuctionListScreen = ({navigation}) => {
})
},
[])
const
handleDelete
=
(
auctionId
)
=>
{
const
url
=
"
http://127.0.0.1:8085/auctions/
"
+
auctionId
axios
.
delete
(
url
)
.
then
(
async
function
(
response
)
{
if
(
response
.
data
.
message
===
'
Deleted!!
'
)
{
const
successMsg
=
Toast
.
show
(
'
Your auction has been deleted successfully
'
,
{
duration
:
Toast
.
durations
.
LONG
,
});
setTimeout
(
function
hideToast
()
{
Toast
.
hide
(
successMsg
);
},
1000
);
navigation
.
navigate
(
'
AuctionHomeScreen
'
);
}
else
{
const
errMsg
=
Toast
.
show
(
'
Auction Deletion Failed
'
,
{
duration
:
Toast
.
durations
.
LONG
,
});
setTimeout
(
function
hideToast
()
{
Toast
.
hide
(
errMsg
);
},
1000
);
}
}).
catch
(
function
(
error
)
{
const
errMsg
=
Toast
.
show
(
'
Auction Deletion Failed
'
,
{
duration
:
Toast
.
durations
.
LONG
,
});
setTimeout
(
function
hideToast
()
{
Toast
.
hide
(
errMsg
);
},
1000
);
})
}
return
(
<
View
style
=
{
styles
.
container
}
>
<
AppContainer
>
...
...
@@ -36,7 +66,7 @@ const UserAuctionListScreen = ({navigation}) => {
navigation
.
navigate
(
"
AuctionDetailScreen
"
,
{
auctionObject
:
auction
})
}
onDelete
=
{()
=>
console
.
log
(
'
delete
'
)}
/
>
onDelete
=
{()
=>
handleDelete
(
auction
.
_id
)}
/
>
)
})}
<
/ScrollView
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment