Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- const RemoveItem = (props) => {
- let handleDeleteItem = async () => {
- if (window.confirm(`Czy na pewno usunąć: ${props.name} ?`) == true) {
- let response = await fetch(`${props.url}`, {
- method: "DELETE",
- headers: {
- "Content-Type":"application/json",
- "Authorization": "Bearer " + String(authTokens.access)
- }
- })
- if(props.refreshList != false){
- props.refreshList();
- }
- }
- }
- return (
- <button onClick={()=>handleDeleteItem()}>usuń</button>
- )
- }
- export default RemoveItem
Advertisement
Add Comment
Please, Sign In to add comment