summaryrefslogtreecommitdiff
path: root/public/js/lib/common
diff options
context:
space:
mode:
authorYukai Huang2017-01-15 03:45:19 +0000
committerYukai Huang2017-01-15 03:45:19 +0000
commit75e28a1d5e0476d73b59b2255aec2b7e6d0a6cdc (patch)
tree12838f33d941e8734c87383c4653b8b63bbd95a6 /public/js/lib/common
parentb3ed4445651b373b14217a55e6382f9025ab345a (diff)
parentc0e8306961a47e7a2ba52d0445c12aaa5fe07949 (diff)
Merge branch 't216-refactor-common' into 'frontend-next'
T216 refactor common See merge request !5
Diffstat (limited to '')
-rw-r--r--public/js/lib/common/login.js (renamed from public/js/common.js)27
1 files changed, 2 insertions, 25 deletions
diff --git a/public/js/common.js b/public/js/lib/common/login.js
index 6d54b450..f1a03c72 100644
--- a/public/js/common.js
+++ b/public/js/lib/common/login.js
@@ -1,21 +1,4 @@
-// import config from './config';
-
-import {
- domain, // domain name
- urlpath, // sub url path, like: www.example.com/<urlpath>
- debug,
- GOOGLE_API_KEY,
- GOOGLE_CLIENT_ID,
- DROPBOX_APP_KEY
-} from './config';
-
-//common
-export const port = window.location.port;
-window.serverurl = `${window.location.protocol}//${domain ? domain : window.location.hostname}${port ? ':' + port : ''}${urlpath ? '/' + urlpath : ''}`;
-export const noteid = urlpath ? window.location.pathname.slice(urlpath.length + 1, window.location.pathname.length).split('/')[1] : window.location.pathname.split('/')[1];
-export const noteurl = `${serverurl}/${noteid}`;
-
-export const version = '0.5.0';
+import { serverurl } from '../config';
let checkAuth = false;
let profile = null;
@@ -49,7 +32,7 @@ export function setLoginState(bool, id) {
export function checkLoginStateChanged() {
if (getLoginState() != lastLoginState || getUserId() != lastUserId) {
- if(loginStateChangeEvent) {
+ if (loginStateChangeEvent) {
loginStateChangeEvent();
}
return true;
@@ -101,12 +84,6 @@ export function checkIfAuth(yesCallback, noCallback) {
}
export default {
- domain,
- urlpath,
- debug,
- GOOGLE_API_KEY,
- GOOGLE_CLIENT_ID,
- DROPBOX_APP_KEY,
checkAuth,
profile,
lastLoginState,