mirror of
https://github.com/mrusme/neonmodem.git
synced 2024-12-04 14:46:37 -05:00
Moved loadPost into main file
This commit is contained in:
parent
36a47727c7
commit
c69287482e
@ -123,25 +123,3 @@ func handleWinFreshDataCmd(mi interface{}, c cmd.Command) (bool, []tea.Cmd) {
|
||||
|
||||
return false, cmds
|
||||
}
|
||||
|
||||
func (m *Model) loadPost(p *post.Post) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
m.ctx.Logger.Debug("------ EXECUTED -----")
|
||||
if err := m.a.LoadPost(p); err != nil {
|
||||
m.ctx.Logger.Error(err)
|
||||
c := cmd.New(
|
||||
cmd.MsgError,
|
||||
WIN_ID,
|
||||
cmd.Arg{Name: "error", Value: err},
|
||||
)
|
||||
return *c
|
||||
}
|
||||
|
||||
c := cmd.New(
|
||||
cmd.WinFreshData,
|
||||
WIN_ID,
|
||||
cmd.Arg{Name: "post", Value: p},
|
||||
)
|
||||
return *c
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"github.com/mrusme/gobbs/aggregator"
|
||||
"github.com/mrusme/gobbs/models/post"
|
||||
"github.com/mrusme/gobbs/models/reply"
|
||||
"github.com/mrusme/gobbs/ui/cmd"
|
||||
"github.com/mrusme/gobbs/ui/ctx"
|
||||
"github.com/mrusme/gobbs/ui/toolkit"
|
||||
)
|
||||
@ -96,3 +97,25 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
|
||||
return m, tea.Batch(cmds...)
|
||||
}
|
||||
|
||||
func (m *Model) loadPost(p *post.Post) tea.Cmd {
|
||||
return func() tea.Msg {
|
||||
m.ctx.Logger.Debug("------ EXECUTED -----")
|
||||
if err := m.a.LoadPost(p); err != nil {
|
||||
m.ctx.Logger.Error(err)
|
||||
c := cmd.New(
|
||||
cmd.MsgError,
|
||||
WIN_ID,
|
||||
cmd.Arg{Name: "error", Value: err},
|
||||
)
|
||||
return *c
|
||||
}
|
||||
|
||||
c := cmd.New(
|
||||
cmd.WinFreshData,
|
||||
WIN_ID,
|
||||
cmd.Arg{Name: "post", Value: p},
|
||||
)
|
||||
return *c
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user