mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 22:02:11 +03:00
bad68bd7c2
refs https://github.com/TryGhost/Ghost/pull/8022 - use `/themes` API endpoint to fetch list of themes instead of `settings[0].availableThemes`
34 lines
813 B
JavaScript
34 lines
813 B
JavaScript
import {Response} from 'ember-cli-mirage';
|
|
|
|
let themeCount = 1;
|
|
|
|
export default function mockThemes(server) {
|
|
server.get('/themes');
|
|
|
|
server.post('/themes/upload/', function ({themes}) {
|
|
// pretender/mirage doesn't currently process FormData so we can't use
|
|
// any info passed in through the request
|
|
let theme = {
|
|
name: `test-${themeCount}`,
|
|
package: {
|
|
name: `Test ${themeCount}`,
|
|
version: '0.1'
|
|
}
|
|
};
|
|
|
|
themeCount++;
|
|
|
|
theme = themes.create(theme);
|
|
|
|
return {
|
|
themes: [theme]
|
|
};
|
|
});
|
|
|
|
server.del('/themes/:theme/', function ({themes}, {params}) {
|
|
themes.findBy({name: params.theme}).destroy();
|
|
|
|
return new Response(204, {}, null);
|
|
});
|
|
}
|