mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-14 05:44:50 +00:00
36 lines
783 B
JavaScript
36 lines
783 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) {
|
||
|
$tw.mws.store.deleteTiddler(title,bag_name);
|
||
|
response.writeHead(204, "OK", {
|
||
|
"Content-Type": "text/plain"
|
||
|
});
|
||
|
response.end();
|
||
|
} else {
|
||
|
response.writeHead(404);
|
||
|
response.end();
|
||
|
}
|
||
|
};
|
||
|
|
||
|
}());
|