1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-12 03:00:28 +00:00
TiddlyWiki5/plugins/tiddlywiki/multiwikiserver/modules/routes/handlers/delete-bag-tiddler.js

37 lines
836 B
JavaScript
Raw Normal View History

/*\
title: $:/plugins/tiddlywiki/multiwikiserver/routes/handlers/delete-bag-tiddler.js
type: application/javascript
module-type: mws-route
DELETE /bags/:bag_name/tiddler/:title
\*/
(function() {
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
exports.method = "DELETE";
exports.path = /^\/bags\/([^\/]+)\/tiddlers\/(.+)$/;
exports.handler = function(request,response,state) {
// Get the parameters
var bag_name = $tw.utils.decodeURIComponentSafe(state.params[0]),
title = $tw.utils.decodeURIComponentSafe(state.params[1]);
if(bag_name) {
2024-03-20 17:56:47 +00:00
var result = $tw.mws.store.deleteTiddler(title,bag_name);
response.writeHead(204, "OK", {
2024-03-20 18:52:54 +00:00
Etag: state.makeTiddlerEtag(result),
"Content-Type": "text/plain"
});
response.end();
} else {
response.writeHead(404);
response.end();
}
};
}());