1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 18:26:26 +00:00

Url share done

This commit is contained in:
Rokt33r
2015-12-13 14:22:45 +09:00
parent a4c72a9a86
commit 24e2544544
11 changed files with 291 additions and 295 deletions

View File

@@ -1,8 +1,8 @@
import _ from 'lodash'
import moment from 'moment'
import keygen from 'boost/keygen'
import dataStore from 'boost/dataStore'
import { request, WEB_URL } from 'boost/api'
import clientKey from 'boost/clientKey'
const electron = require('electron')
const version = electron.remote.app.getVersion()
@@ -28,16 +28,6 @@ export function init () {
}
}
export function getClientKey () {
let clientKey = localStorage.getItem('clientKey')
if (!_.isString(clientKey) || clientKey.length !== 40) {
clientKey = keygen()
localStorage.setItem('clientKey', clientKey)
}
return clientKey
}
export function getAllRecords () {
return JSON.parse(localStorage.getItem('activityRecords'))
}
@@ -67,7 +57,7 @@ export function postRecords (data) {
console.log('posting...', records)
let input = {
clientKey: getClientKey(),
clientKey: clientKey.get(),
records
}
return request.post(WEB_URL + 'apis/activity')
@@ -142,6 +132,5 @@ export function emit (type, data = {}) {
export default {
init,
emit,
getClientKey,
postRecords
}