mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-01-18 04:59:02 +02:00
cleared mods and modpack handler
This commit is contained in:
parent
251d937b4d
commit
ec16db3983
File diff suppressed because it is too large
Load Diff
@ -14,8 +14,8 @@ const Mods = () => {
|
||||
const fetchInstalledMods = () => {
|
||||
modsResource.installed()
|
||||
.then(res => {
|
||||
if (res.success) {
|
||||
setInstalledMods(res.data || []);
|
||||
if (res) {
|
||||
setInstalledMods(res || []);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ const Mod = ({refreshInstalledMods, mod, factorioVersion}) => {
|
||||
|
||||
const toggleMod = async modName => {
|
||||
const res = await modsResource.toggle(modName);
|
||||
if (res.success) {
|
||||
if (res) {
|
||||
refreshInstalledMods();
|
||||
}
|
||||
}
|
||||
@ -47,8 +47,8 @@ const Mod = ({refreshInstalledMods, mod, factorioVersion}) => {
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const {success, data} = await modsResource.details(mod.name)
|
||||
if (success) {
|
||||
const {data} = await modsResource.details(mod.name)
|
||||
if (data) {
|
||||
//get newest COMPATIBLE release
|
||||
let newestRelease;
|
||||
data.releases.forEach(release => {
|
||||
|
@ -6,44 +6,30 @@ const mods = {
|
||||
return response.data;
|
||||
},
|
||||
toggle: async modName => {
|
||||
let data = new FormData();
|
||||
data.set('modName', modName);
|
||||
|
||||
const response = await client.post('/api/mods/toggle', data);
|
||||
const response = await client.post('/api/mods/toggle', JSON.stringify({modName}));
|
||||
return response.data;
|
||||
},
|
||||
delete: async modName => {
|
||||
const data = new FormData();
|
||||
data.set('modName', modName);
|
||||
|
||||
const response = await client.post('/api/mods/delete', data);
|
||||
const response = await client.post('/api/mods/delete', JSON.stringify({modName}));
|
||||
return response.data;
|
||||
},
|
||||
details: async modName => {
|
||||
const data = new FormData();
|
||||
data.set('modId', modName);
|
||||
|
||||
const response = await client.post('/api/mods/details', data);
|
||||
const response = await client.post('/api/mods/details', JSON.stringify({modName}));
|
||||
|
||||
return {
|
||||
success: response.data.success,
|
||||
data: JSON.parse(response.data.data)
|
||||
data: JSON.parse(response.data)
|
||||
};
|
||||
},
|
||||
update: async (modName, downloadUrl, fileName) => {
|
||||
const data = new FormData();
|
||||
data.set('modName', modName);
|
||||
data.set('downloadUrl', downloadUrl);
|
||||
data.set('filename', fileName);
|
||||
const data = {
|
||||
modName: modName,
|
||||
downloadUrl: downloadUrl,
|
||||
fileName: fileName,
|
||||
}
|
||||
|
||||
const response = await client.post('/api/mods/update', data, {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
})
|
||||
const response = await client.post('/api/mods/update', data)
|
||||
return response.data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default mods;
|
Loading…
x
Reference in New Issue
Block a user