Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private func login() {
- let url = "/user/login/hubnami"
- Alamofire.request(.POST, baseURL + url, parameters: ["email": self.email, "password": self.password!, "csrf_test_name": self.token], encoding: ParameterEncoding.URL, headers: nil).responseJSON { (_, _, jsonResponse, _) -> Void in
- var json = JSON(jsonResponse!)
- if json != nil {
- println(json)
- if json["status"] == "success" {
- println("LOGIN: Success!.")
- self.isLogin = true
- } else if json["status"] == "failed" {
- println("LOGIN: Failed!.")
- }
- } else {
- println(json)
- }
- }
- }
- var user = HKUser(email: "phuonglm86@gmail.com", password: "123456")
- user.login()
- {
- "status" : "success",
- "data" : {
- "redirect_url" : false,
- "info" : {
- "language" : "en_US",
- "userLoggedIn" : "1",
- "networkKeys" : {
- "google" : "AIzaSyALVLyEVwIhhfEH5SN65-UVMLlOS5YWRJI",
- "facebook" : "CAAFVXuEkiCcBAEWYixhrKVJstmmDlvJQRNizaTguniPfm7FI3SkimwjjZAyKiQQJZBKeSG7yi3k3imBeEuXL2x5F7xlz8qoazoWWbpobtmmFEhYOBZBNC5FIVcKRxB0f4uJTNMYJAU8HQeAP2ydb3K31ENrwXMbbgggZCwAXZB4sjR4YmgBZATvS4U9pBXeSl0nMZBXXZCOc3ZCZBh8W365r3q",
- "vimeo" : "298b04d74270272cb305811626209408",
- "instagram" : "da5dadde525841569a0fe79ed5e489a4",
- "bitly" : "14a6d5f0d13e4159f51a5054bdbdaf52fad6a14b"
- },
- "timezone_offset" : 25200,
- "accountCreatedTime" : 1439338073,
- "scope" : "client",
- "userId" : "2466",
- "accountId" : "4270",
- "userName" : "Phuong",
- "accountName" : "Phuong",
- "userEmail" : "phuonglm86@gmail.com",
- "userPicture" : "https://graph.facebook.com/v2.3/944873948889162/picture",
- "timezone" : "Asia/Jakarta",
- "role" : "admin",
- "startTime" : "2015-07-28",
- "endTime" : "2015-08-26",
- "memberSince" : 1439338073
- }
- }
- }
- func getAllUserDashboards() {
- let url = "/profile/get_tags_all"
- Alamofire.request(.GET, baseURL + url, parameters: nil, encoding: .URL, headers: nil).responseJSON { (_, _, jsonData, _) -> Void in
- if jsonData != nil {
- println("Get All Dashboards: Success!")
- self.dashboards = JSON(jsonData!)
- println(jsonData!)
- } else {
- println("Get All Dashboards: Failed!")
- }
- }
- }
- func creatNewDashboard(nameDashboard: String) {
- let url = "/account/create_dashboard"
- Alamofire.request(.GET, baseURL + url, parameters: ["tag_name": nameDashboard], encoding: .URL, headers: nil).responseJSON() { (request, response, jsonData, _) -> Void in
- if jsonData != nil {
- println("Create Dashboard: Success!")
- println("Create Dashboard (jsonData!)")
- } else {
- println("Create Dashboard: Failed!")
- }
- }
- }
- user.getAllUserDashboards()
- user.creatNewDashboard("new_Dashboard")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement