Advertisement
repente

Untitled

May 14th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import m from 'mithril';
  2. // var m = require("mithril");
  3.  
  4. var computer = {
  5. operatingSystems: [
  6. { id: 1, name: "Windows 10" },
  7. { id: 2, name: "Windows 7" },
  8. { id: 3, name: "MacOS" },
  9. { id: 4, name: "Debian" },
  10. { id: 4, name: "Ubuntu" }
  11. ],
  12. current: {},
  13. load: function(id) {
  14. return m.request({
  15. method: "GET",
  16. url: "www.api-url.com/load/" + id
  17. }).then(function(result) {
  18. computer.current = result;
  19. });
  20. },
  21. save: function() {
  22. return m.request({
  23. method: "PUT",
  24. url: "www.api-url.com/save",
  25. data: computer.current
  26. }).then(function() {
  27. m.route.set("/computers");
  28. });
  29. }
  30. };
  31.  
  32. export { computer };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement