Commits

Maxim Moiseev committed 1679c9a

login module refactored

Comments (0)

Files changed (1)

src/VkontakteAPI/Linq2vk/Api.fs

 open System
 open System.Text
 
-module Login =
-
-    let LoginUrl = "http://vk.com/login.php"
-
-    let makeLoginUrl (appId:int64) =
-        let sb = StringBuilder()
-        sb.Append(LoginUrl).Append("?") |> ignore
-        let args = [
-            ("app", string appId);
-            ("layout", "popup");
-            ("type", "browser");
-            ("settings", "130")
-        ]
-        args |>
-            Seq.iter (fun (k, v) -> sb.AppendFormat("{0}={1}&", k, v) |> ignore)
-        sb.ToString()
-
 module Net =
     
     module Query =
             builder.ToString()
 
         let toQueryString =
-            joinWith (fun (k, v) -> sprintf "%s=%s;" k v)
+            joinWith (fun (k, v) -> sprintf "%s=%s&" k v)
 
         let sort (Query q) =
             Query <| List.sort q
             let expected = "4a5bf45c9fe5c66d3afa73d8520fe46a"
             actual = expected
 
+module Login =
+
+    let LoginUrlBase = "http://vk.com/login.php"
+
+    let makeLoginUrl (appId:int64) (settings:int64) =
+        let query = Net.Query.fromSeq [
+            ("app", string appId);
+            ("layout", "popup");
+            ("type", "browser");
+            ("settings", string settings)
+        ]
+        sprintf "%s?%s" LoginUrlBase (Net.Query.toQueryString query)
+
 
 module Api =