func DoSync() { host := util.CouchHost() dbName := "user-" + util.CurrentUser() ldb := pouchdb.New(dbName) rdb := pouchdb.New(host + "/" + dbName) result, err := pouchdb.Replicate(rdb, ldb, pouchdb.Options{}) console.Log("error = %j", err) console.Log("result = %j", result) }
func CheckAuth(h jqeventrouter.Handler) jqeventrouter.Handler { return jqeventrouter.HandlerFunc(func(event *jquery.Event, ui *js.Object) bool { console.Log("CheckAuth") uri := util.JqmTargetUri(ui) console.Log("Auth URI = %s", uri) if uri != "/login.html" && util.CurrentUser() == "" { console.Log("nobody's logged in") // Nobody's logged in ui.Set("toPage", "login.html") event.StopImmediatePropagation() console.Log("Attempting to re-trigger the event") jquery.NewJQuery(":mobile-pagecontainer").Trigger("pagecontainerbeforechange", ui) return true } console.Log("Auth allowing to proceed") return h.HandleEvent(event, ui) }) }