add "delete all mods" feature

This commit is contained in:
Jan Naahs 2020-08-23 18:42:25 +02:00
parent 2c447e242e
commit 36265c05ee
2 changed files with 16 additions and 2 deletions

View File

@ -20,6 +20,15 @@ const Mods = () => {
});
};
const deleteAllMods = () => {
modsResource.deleteAll()
.then(res => {
if(res.success) {
fetchInstalledMods();
}
})
}
useEffect(() => {
server.factorioVersion()
.then(res => {
@ -55,7 +64,9 @@ const Mods = () => {
</table>
}
actions={
<Button size="sm" type="danger" onClick={deleteAllMods}>Delete all Mods</Button>
}
/>
</>
)

View File

@ -42,8 +42,11 @@ const mods = {
}
})
return response.data;
},
deleteAll: async () => {
const response = await client.post('/api/mods/delete/all');
return response.data;
}
}
export default mods;