1
0
mirror of https://github.com/mrusme/neonmodem.git synced 2024-09-22 04:35:55 -04:00

Fixed topics path

This commit is contained in:
マリウス 2022-12-30 02:58:28 -05:00
parent e0539b4954
commit b78f1d0c46
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F
3 changed files with 7 additions and 3 deletions

View File

@ -83,6 +83,10 @@ var rootCmd = &cobra.Command{
fmt.Println("-----------------------") fmt.Println("-----------------------")
fmt.Printf("%v\n", posts) fmt.Printf("%v\n", posts)
fmt.Printf("%v\n", err) fmt.Printf("%v\n", err)
err = (*c.Systems[0]).LoadPost(&posts[4])
fmt.Printf("%v\n", posts[4].Replies[2])
fmt.Printf("%v\n", err)
os.Exit(0) os.Exit(0)
tui := tea.NewProgram(ui.NewModel(&c), tea.WithAltScreen()) tui := tea.NewProgram(ui.NewModel(&c), tea.WithAltScreen())

View File

@ -123,7 +123,7 @@ func (sys *System) ListPosts() ([]post.Post, error) {
func (sys *System) LoadPost(p *post.Post) error { func (sys *System) LoadPost(p *post.Post) error {
item, err := sys.client.Topics.Show(context.Background(), p.ID) item, err := sys.client.Topics.Show(context.Background(), p.ID)
if err != nil { if err != nil {
return nil return err
} }
for idx, i := range item.PostStream.Posts { for idx, i := range item.PostStream.Posts {

View File

@ -5,7 +5,7 @@ import (
"net/http" "net/http"
) )
const TopicsBaseURL = "/topics" const TopicsBaseURL = "/t"
type LatestTopicsResponse struct { type LatestTopicsResponse struct {
Users []struct { Users []struct {
@ -94,7 +94,7 @@ func (a *TopicServiceHandler) Show(
ctx context.Context, ctx context.Context,
id string, id string,
) (*SingleTopicResponse, error) { ) (*SingleTopicResponse, error) {
uri := TopicsBaseURL + "/t/" + id + ".json" uri := TopicsBaseURL + "/" + id + ".json"
req, err := a.client.NewRequest(ctx, http.MethodGet, uri, nil) req, err := a.client.NewRequest(ctx, http.MethodGet, uri, nil)
if err != nil { if err != nil {