1
0
Fork 0
mirror of https://github.com/TryGhost/Ghost-Admin.git synced 2023-12-14 02:33:04 +01:00
Ghost-Admin/mirage/config/uploads.js
Kevin Ansfield 9db932ee48 streamline image uploads in settings/general (#702)
refs TryGhost/Ghost#8455

- ensure `uploadUrls` and `errors` are cleared in `gh-uploader` when new uploads are started
- yield `isUploading` in `gh-uploader` component
- replace image upload modals in settings/general with in-page uploads
2017-05-23 10:50:04 +02:00

17 lines
533 B
JavaScript

const fileUploadResponse = function (db, {requestBody}) {
let [file] = requestBody.getAll('uploadimage');
let now = new Date();
let year = now.getFullYear();
let month = `${now.getMonth()}`;
if (month.length === 1) {
month = `0${month}`;
}
return `"/content/images/${year}/${month}/${file.name}"`;
};
export default function mockUploads(server) {
server.post('/uploads/', fileUploadResponse, 200, {timing: 100});
server.post('/uploads/icon/', fileUploadResponse, 200, {timing: 100});
}