feature: delete modpacks

This commit is contained in:
Jan Naahs 2020-10-29 22:02:52 +01:00
parent f92564b1a8
commit b79efab742
2 changed files with 15 additions and 3 deletions

View File

@ -116,7 +116,7 @@ const Mods = () => {
</tr>
</thead>
<tbody>
{modPacks.map((pack, i) => <ModPack key={i} modPack={pack}/>)}
{modPacks.map((pack, i) => <ModPack key={i} modPack={pack} reloadModPacks={fetchModPacks}/>)}
</tbody>
</table>
}

View File

@ -1,10 +1,22 @@
import React from "react";
import {faTrashAlt} from "@fortawesome/free-solid-svg-icons";
import {FontAwesomeIcon} from "@fortawesome/react-fontawesome";
import modsResource from "../../../../api/resources/mods";
const ModPack = ({modPack, reloadModPacks}) => {
const deleteModPack = name => {
modsResource.packs.delete(name)
.then(reloadModPacks)
}
const ModPack = ({modPack}) => {
return (
<tr>
<td>{modPack.name}</td>
<td/>
<td>
<FontAwesomeIcon className={"text-red cursor-pointer hover:text-red-light"}
onClick={() => deleteModPack(modPack.name)} icon={faTrashAlt}/>
</td>
</tr>
)
}