Translated using Weblate (Polish)
[project/luci.git] / modules / luci-mod-system / htdocs / luci-static / resources / view / system / reboot.js
index 3b9f450fcd9f8336ac7249b45da88e0176258f19..92e1dd49208f465f0d91099fa69c64b74b800161 100644 (file)
@@ -1,9 +1,15 @@
 'use strict';
 'require view';
-'require fs';
+'require rpc';
 'require ui';
 'require uci';
 
+var callReboot = rpc.declare({
+       object: 'system',
+       method: 'reboot',
+       expect: { result: 0 }
+});
+
 return view.extend({
        load: function() {
                return uci.changes();
@@ -31,9 +37,9 @@ return view.extend({
        },
 
        handleReboot: function(ev) {
-               return fs.exec('/sbin/reboot').then(function(res) {
-                       if (res.code != 0) {
-                               L.ui.addNotification(null, E('p', _('The reboot command failed with code %d').format(res.code)));
+               return callReboot().then(function(res) {
+                       if (res != 0) {
+                               L.ui.addNotification(null, E('p', _('The reboot command failed with code %d').format(res)));
                                L.raise('Error', 'Reboot failed');
                        }