[Groonga-commit] groonga/gcs-console [master] domainDelete does not require withDomain

Back to archive index

Yoji SHIDARA null+****@clear*****
Thu Oct 18 15:12:47 JST 2012


Yoji SHIDARA	2012-10-18 15:12:47 +0900 (Thu, 18 Oct 2012)

  New Revision: 5eadedbb30006fc671fde78c72608223f5c965f2
  https://github.com/groonga/gcs-console/commit/5eadedbb30006fc671fde78c72608223f5c965f2

  Log:
    domainDelete does not require withDomain

  Modified files:
    routes/index.js

  Modified: routes/index.js (+10 -16)
===================================================================
--- routes/index.js    2012-10-18 14:48:34 +0900 (d5e1790)
+++ routes/index.js    2012-10-18 15:12:47 +0900 (f9a5548)
@@ -165,22 +165,16 @@ exports.domainCreatePost = function(req, res) {
 };
 
 exports.domainDelete = function(req, res) {
-  withDomain(req, res, function(req, res) {
-    req.cloudsearch.DeleteDomain({
-      DomainName: req.domain.DomainName
-    }, function(error, data) {
-      if (error) {
-        // TODO redirect back domainCreate if it is a kind of validation error
-        // TODO render error in a more pretty way
-        // TODO in some cases, the error should be 400 rather than 500
-        res.status(500);
-        var message = JSON.stringify(error.Body.Response.Errors);
-        res.render('error', {message: message});
-        return;
-      }
+  req.cloudsearch.DeleteDomain({
+    DomainName: req.params.name
+  }, function(error, data) {
+    if (error) {
+      res.status(500);
+      res.render('error', {error: new Error(error.Message)});
+      return;
+    }
 
-      res.redirect('/');
-      // TODO some feedback to user may be needed
-    });
+    res.redirect('/');
+    // TODO some feedback to user may be needed
   });
 };
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index