Remove casting from formdata

This commit is contained in:
Joey Yakimowich-Payne 2020-02-15 09:35:05 -07:00
commit 7337bceff3
2 changed files with 5 additions and 2 deletions

View file

@ -1,6 +1,7 @@
when defined(js):
import sugar, httpcore, options, json
import dom except Event
import jsffi except `&`
include karax/prelude
import karax / [kajax, kdom]
@ -44,7 +45,8 @@ when defined(js):
formData.append("subject", state.subject)
formData.append("msg", state.replyBox.getText())
formData.append("categoryId", $categoryID)
ajaxPost(uri, @[], cast[cstring](formData),
ajaxPost(uri, @[], formData.to(cstring),
(s: int, r: kstring) => onCreatePost(s, r, state))
proc render*(state: NewThread, currentUser: Option[User]): VNode =

View file

@ -15,6 +15,7 @@ type
when defined(js):
from dom import document
import jsffi except `&`
include karax/prelude
import karax / [vstyles, kajax, kdom]
@ -76,7 +77,7 @@ when defined(js):
state.loading = true
ajaxPost(uri, @[], cast[cstring](formData),
ajaxPost(uri, @[], formData.to(cstring),
(s: int, r: kstring) => onCategoryPost(s, r, state))
proc onPostList(httpStatus: int, response: kstring, postId: Option[int]) =