mirror of
https://github.com/emo2007/block-accounting.git
synced 2025-04-12 08:56:28 +00:00
moved response logic into authPresenter
This commit is contained in:
parent
16cf2c2d0a
commit
21dce23d0e
@ -1,12 +1,10 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log/slog"
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/emochka2007/block-accounting/internal/interface/rest/domain"
|
|
||||||
"github.com/emochka2007/block-accounting/internal/interface/rest/presenters"
|
"github.com/emochka2007/block-accounting/internal/interface/rest/presenters"
|
||||||
"github.com/emochka2007/block-accounting/internal/pkg/bip32"
|
"github.com/emochka2007/block-accounting/internal/pkg/bip32"
|
||||||
)
|
)
|
||||||
@ -48,19 +46,7 @@ func (c *authController) Join(w http.ResponseWriter, req *http.Request) error {
|
|||||||
|
|
||||||
// todo create user
|
// todo create user
|
||||||
|
|
||||||
// move to presenter
|
return c.presenter.ResponseJoin(w, mnemonic)
|
||||||
out, err := json.Marshal(domain.JoinResponse{
|
|
||||||
Mnemonic: mnemonic,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error marshal join response. %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
w.Write(out)
|
|
||||||
|
|
||||||
// move to presenter
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *authController) Login(w http.ResponseWriter, req *http.Request) error {
|
func (c *authController) Login(w http.ResponseWriter, req *http.Request) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user