Commit ecd9f3de authored by Mihkel Putrinš's avatar Mihkel Putrinš

refactor

parent a04ec861
var app = require('app')
var op = require('object-path')
// var op = require('object-path')
var path = require('path')
var fs = require('fs')
var ipc = require('ipc')
......@@ -88,7 +88,7 @@ ipc.on('setUser', function(event, data) {
user_data = data
// console.log('setUser: ' + JSON.stringify(user_data, null, 4))
})
ipc.on('getUser', function(event, msg) {
ipc.on('getUser', function(event) {
event.returnValue = user_data
// console.log('getUser: ' + JSON.stringify(user_data, null, 4))
})
......
var request = require('request')
// var request = require('request')
var fs = require('fs')
var op = require('object-path')
var path = require('path')
......@@ -29,9 +29,9 @@ function initialize() {
}
// console.log('user_data: ' + JSON.stringify(data, null, 4))
if (op.get(data, 'result.user_id', false)) {
user_data['user_id'] = op.get(data, 'result.user_id')
user_data['session_key'] = op.get(data, 'result.session_key')
user_data['name'] = op.get(data, 'result.name')
user_data.user_id = op.get(data, 'result.user_id')
user_data.session_key = op.get(data, 'result.session_key')
user_data.name = op.get(data, 'result.name')
document.getElementById('userName').innerHTML = user_data.name
var title = UPLOADER_VERSION + ' | ' + user_data.name
ipc.send('setTitle', title)
......
......@@ -10,7 +10,6 @@ var async = require('async')
var b2s = require(path.join(__dirname, '..', 'code', 'bytesToSize.js'))
var resource_root_eid = 4387
var i = 0
var uploaded_resources_progress
var uploaded_files_progress
ENTU_API_ENTITY = 'https://entu.keeleressursid.ee/api2/entity'
......@@ -91,7 +90,7 @@ function addEntuProperties(eid, data, callback) {
xhr.setRequestHeader('X-Auth-UserId', user_data.user_id)
xhr.setRequestHeader('X-Auth-Token', user_data.session_key)
xhr.onload = function () {
var response = JSON.parse(this.responseText)
// var response = JSON.parse(this.responseText)
// console.log(JSON.stringify({sent:data, got:response}, null, 4))
callback()
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment