misc_pterodactyl-panel/resources/scripts/api/server/files/getFileContents.ts

14 lines
445 B
TypeScript
Raw Normal View History

import http from '@/api/http';
export default (server: string, file: string): Promise<string> => {
return new Promise((resolve, reject) => {
http.get(`/api/client/servers/${server}/files/contents`, {
params: { file: encodeURI(decodeURI(file)) },
transformResponse: res => res,
2019-12-07 20:12:33 +00:00
responseType: 'text',
})
.then(({ data }) => resolve(data))
.catch(reject);
});
};