feat: display user after login
continuous-integration/drone/push Build is failing Details

main
RaviAnand Mohabir 11 months ago
parent a1ae73f9cb
commit a50fac7d52

@ -56,5 +56,7 @@ func Callback(app *core.App) func(w http.ResponseWriter, r *http.Request) {
user, _ := spotifyClient.CurrentUser(ctx)
users.SaveUserToken(ctx, app, user.ID, token)
app.Render.JSON(w, 200, user)
}
}

@ -5,16 +5,16 @@ import (
"net/http"
"net/url"
mongodbstore "github.com/2-72/gorilla-sessions-mongodb"
"github.com/go-chi/chi"
"github.com/gorilla/sessions"
"github.com/spf13/viper"
"github.com/unrolled/render"
spotifyauth "github.com/zmb3/spotify/v2/auth"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
"golang.org/x/oauth2"
"gopkg.in/mgo.v2"
mongodbstore "github.com/2-72/gorilla-sessions-mongodb"
)
type App struct {
@ -24,6 +24,7 @@ type App struct {
SpotifyOAuthConfig *oauth2.Config
Mux *chi.Mux
SessionStore sessions.Store
Render *render.Render
}
func (a App) Run() {
@ -81,12 +82,15 @@ func NewApp() *App {
mux := NewMux()
r := render.New()
app := &App{
MongoClient: client,
SpotifyAuth: auth,
SpotifyOAuthConfig: authConfig,
Mux: mux,
SessionStore: store,
Render: r,
}
return app

@ -23,8 +23,6 @@ func SyncMonthlyList(ctx context.Context, app *core.App, user *models.User) (int
playlistName := fmt.Sprintf("%d %d", beginningOfMonth.Year(), beginningOfMonth.Month())
fmt.Println(playlistName)
var playlist *spotify.SimplePlaylist
playlists, err := client.CurrentUsersPlaylists(ctx)

Loading…
Cancel
Save