2020-08-22 00:33:16 +02:00
|
|
|
import client from "../client";
|
|
|
|
|
|
|
|
|
|
const mods = {
|
|
|
|
|
installed: async () => {
|
2020-09-04 17:48:18 +02:00
|
|
|
const response = await client.get('/api/mods/list');
|
2020-08-22 00:33:16 +02:00
|
|
|
return response.data;
|
|
|
|
|
},
|
2020-10-16 13:06:05 +02:00
|
|
|
toggle: async name => {
|
|
|
|
|
const response = await client.post('/api/mods/toggle', {name});
|
2020-08-22 00:33:16 +02:00
|
|
|
return response.data;
|
|
|
|
|
},
|
2020-10-16 13:06:05 +02:00
|
|
|
delete: async name => {
|
|
|
|
|
const response = await client.post('/api/mods/delete', {name});
|
2020-08-22 00:33:16 +02:00
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
update: async (modName, downloadUrl, fileName) => {
|
2020-08-25 04:53:21 +02:00
|
|
|
const data = {
|
|
|
|
|
modName: modName,
|
|
|
|
|
downloadUrl: downloadUrl,
|
|
|
|
|
fileName: fileName,
|
|
|
|
|
}
|
2020-08-22 00:33:16 +02:00
|
|
|
|
2020-08-25 04:53:21 +02:00
|
|
|
const response = await client.post('/api/mods/update', data)
|
2020-08-22 00:33:16 +02:00
|
|
|
return response.data;
|
2020-08-23 18:42:25 +02:00
|
|
|
},
|
2020-10-24 12:24:58 +02:00
|
|
|
upload: async file => {
|
|
|
|
|
let formData = new FormData();
|
|
|
|
|
formData.append("mod_file", file);
|
|
|
|
|
|
|
|
|
|
const response = await client.post('/api/mods/upload', formData, {
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "multipart/form-data"
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
2020-08-23 18:42:25 +02:00
|
|
|
deleteAll: async () => {
|
|
|
|
|
const response = await client.post('/api/mods/delete/all');
|
|
|
|
|
return response.data;
|
2020-09-12 11:29:19 +02:00
|
|
|
},
|
|
|
|
|
portal: {
|
|
|
|
|
login: async (username, password) => {
|
|
|
|
|
const response = await client.post('/api/mods/portal/login', {
|
|
|
|
|
username,
|
|
|
|
|
password
|
|
|
|
|
});
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
status: async () => {
|
|
|
|
|
const response = await client.get('/api/mods/portal/loginstatus');
|
|
|
|
|
return response.data;
|
|
|
|
|
},
|
|
|
|
|
logout: async () => {
|
|
|
|
|
const response = await client.get('/api/mods/portal/logout');
|
|
|
|
|
return response.data
|
2020-09-20 20:07:15 +02:00
|
|
|
},
|
|
|
|
|
installMultiple: async mods => {
|
|
|
|
|
const response = await client.post('/api/mods/portal/install/multiple', mods);
|
|
|
|
|
return response.data
|
|
|
|
|
},
|
2020-10-11 21:28:59 +02:00
|
|
|
install: async (downloadUrl, fileName, modName) => {
|
|
|
|
|
const response = await client.post('/api/mods/portal/install', {
|
|
|
|
|
downloadUrl,
|
|
|
|
|
fileName,
|
|
|
|
|
modName
|
|
|
|
|
});
|
|
|
|
|
return response.data
|
|
|
|
|
},
|
2020-09-20 20:07:15 +02:00
|
|
|
list: async () => {
|
|
|
|
|
const response = await client.get('/api/mods/portal/list');
|
|
|
|
|
return response.data
|
2020-10-11 19:06:51 +02:00
|
|
|
},
|
|
|
|
|
info: async mod => {
|
|
|
|
|
const response = await client.get(`/api/mods/portal/info/${mod}`);
|
|
|
|
|
return response.data;
|
2020-09-12 11:29:19 +02:00
|
|
|
}
|
2020-08-22 00:33:16 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default mods;
|