mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
18 lines
533 B
JavaScript
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});
|
||
|
}
|