mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-12 03:00:28 +00:00
38 lines
890 B
JavaScript
38 lines
890 B
JavaScript
/*\
|
|
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) {
|
|
var result = $tw.mws.store.deleteTiddler(title,bag_name);
|
|
response.writeHead(204, "OK", {
|
|
"X-Revision-Number": result.tiddler_id.toString(),
|
|
Etag: state.makeTiddlerEtag(result),
|
|
"Content-Type": "text/plain"
|
|
});
|
|
response.end();
|
|
} else {
|
|
response.writeHead(404);
|
|
response.end();
|
|
}
|
|
};
|
|
|
|
}());
|