@@ -17,35 +17,35 @@ type signInRequestBody struct {
1717 Password * string `json:"password"`
1818}
1919
20- func SignInPost (apiInterface dashboardmodels.APIInterface , options dashboardmodels.APIOptions ) ( signInPostResponse , error ) {
20+ func SignInPost (apiInterface dashboardmodels.APIInterface , options dashboardmodels.APIOptions ) error {
2121 body , err := supertokens .ReadFromRequest (options .Req )
2222
2323 if err != nil {
24- return signInPostResponse {}, err
24+ return err
2525 }
2626
2727 var readBody signInRequestBody
2828 err = json .Unmarshal (body , & readBody )
2929 if err != nil {
30- return signInPostResponse {}, err
30+ return err
3131 }
3232
3333 if readBody .Email == nil {
34- return signInPostResponse {}, supertokens.BadInputError {
34+ return supertokens.BadInputError {
3535 Msg : "Required parameter 'email' is missing" ,
3636 }
3737 }
3838
3939 if readBody .Password == nil {
40- return signInPostResponse {}, supertokens.BadInputError {
40+ return supertokens.BadInputError {
4141 Msg : "Required parameter 'password' is missing" ,
4242 }
4343 }
4444
4545 querier , querierErr := supertokens .GetNewQuerierInstanceOrThrowError ("dashboard" )
4646
4747 if querierErr != nil {
48- return signInPostResponse {}, querierErr
48+ return querierErr
4949 }
5050
5151 apiResponse , apiErr := querier .SendPostRequest ("/recipe/dashboard/signin" , map [string ]interface {}{
@@ -54,26 +54,26 @@ func SignInPost(apiInterface dashboardmodels.APIInterface, options dashboardmode
5454 })
5555
5656 if apiErr != nil {
57- return signInPostResponse {}, apiErr
57+ return apiErr
5858 }
5959
6060 status , ok := apiResponse ["status" ]
6161
6262 if ok && status == "OK" {
63- return signInPostResponse {
64- Status : "OK" ,
65- SessionId : apiResponse ["sessionId" ].(string ),
66- }, nil
63+ return supertokens . Send200Response ( options . Res , map [ string ] interface {} {
64+ "status" : "OK" ,
65+ "sessionId" : apiResponse ["sessionId" ].(string ),
66+ })
6767 }
6868
6969 if status == "USER_SUSPENDED_ERROR" {
70- return signInPostResponse {
71- Status : "USER_SUSPENDED_ERROR" ,
72- Message : apiResponse ["message" ].(string ),
73- }, nil
70+ return supertokens . Send200Response ( options . Res , map [ string ] interface {} {
71+ "status" : "USER_SUSPENDED_ERROR" ,
72+ "message" : apiResponse ["message" ].(string ),
73+ })
7474 }
7575
76- return signInPostResponse {
77- Status : "INVAlID_CREDENTIALS_ERROR" ,
78- }, nil
76+ return supertokens . Send200Response ( options . Res , map [ string ] interface {} {
77+ "status" : "INVAlID_CREDENTIALS_ERROR" ,
78+ })
7979}
0 commit comments