Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- // Set up socket.io
- var host = 'http://192.241.216.158:3030';
- var socket = io(host);
- // Setup variables before execution
- // Set up Feathers client side
- var app = feathers()
- .configure(feathers.socketio(socket))
- .configure(feathers.hooks())
- .configure(feathers.authentication({ storage: window.localStorage }));
- // Authenticating using a token instead
- app.authenticate({
- type: 'token',
- 'token': Cookies.get('feathers-jwt')
- }).then(function(result){
- // Authentication Information
- console.log('Authenticated!', app.get('token'));
- // Changing Full Name
- user = app.get('user');
- fullname = document.getElementById('#fullname');
- fullname.innerHTML = "<i class=\"fa fa-chevron-down\"></i> " + user.firstname;
- // Add Icons to Table
- icons = app.service('icons');
- icons.find().then(page => {
- icon_data = page.data;
- Vue.component('row-tpl', {
- template: '#row-template',
- props: ['row'],
- data() {return {
- mode: 'Normal'
- }},
- methods: {
- edit() {
- this.mode = 'Edit';
- },
- save() {
- icons.update(this.row.id, {htmlid: this.row.htmlid, class: this.row.class});
- console.log(this.row.id + " " + this.row.htmlid + " " + this.row.class);
- this.mode = 'Normal';
- },
- cancel() {
- this.mode = 'Normal';
- }
- }
- })
- new Vue({
- el: '#vueTable',
- data: {
- rows: icon_data
- },
- methods: {}
- })
- });
- }).catch(function(error){
- console.error('Error authenticating!', error);
- window.location = "/signin.html";
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement