Advertisement
Guest User

Untitled

a guest
May 24th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <script type="text/javascript">
  2. // Set up socket.io
  3. var host = 'http://192.241.216.158:3030';
  4. var socket = io(host);
  5.  
  6. // Setup variables before execution
  7.  
  8. // Set up Feathers client side
  9. var app = feathers()
  10. .configure(feathers.socketio(socket))
  11. .configure(feathers.hooks())
  12. .configure(feathers.authentication({ storage: window.localStorage }));
  13.  
  14. // Authenticating using a token instead
  15. app.authenticate({
  16. type: 'token',
  17. 'token': Cookies.get('feathers-jwt')
  18. }).then(function(result){
  19.  
  20. // Authentication Information
  21. console.log('Authenticated!', app.get('token'));
  22.  
  23. // Changing Full Name
  24. user = app.get('user');
  25. fullname = document.getElementById('#fullname');
  26. fullname.innerHTML = "<i class=\"fa fa-chevron-down\"></i> " + user.firstname;
  27.  
  28. // Add Icons to Table
  29. icons = app.service('icons');
  30. icons.find().then(page => {
  31. icon_data = page.data;
  32.  
  33. Vue.component('row-tpl', {
  34. template: '#row-template',
  35. props: ['row'],
  36. data() {return {
  37. mode: 'Normal'
  38. }},
  39. methods: {
  40. edit() {
  41. this.mode = 'Edit';
  42. },
  43. save() {
  44. icons.update(this.row.id, {htmlid: this.row.htmlid, class: this.row.class});
  45. console.log(this.row.id + " " + this.row.htmlid + " " + this.row.class);
  46. this.mode = 'Normal';
  47. },
  48. cancel() {
  49. this.mode = 'Normal';
  50. }
  51. }
  52. })
  53.  
  54. new Vue({
  55. el: '#vueTable',
  56. data: {
  57. rows: icon_data
  58. },
  59. methods: {}
  60. })
  61. });
  62.  
  63. }).catch(function(error){
  64. console.error('Error authenticating!', error);
  65. window.location = "/signin.html";
  66. });
  67. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement