Ghost/ghost/admin/mirage/config/uploads.js
Kevin Ansfield 8d66430c2a 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

18 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});
}