Skip to content

Commit

Permalink
Ensuring that index is unloaded when a new repo is selected
Browse files Browse the repository at this point in the history
  • Loading branch information
ItalyPaleAle committed Aug 30, 2020
1 parent 07a7892 commit 99b9dd8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ packrd/
# Development
old/
test/
test2/
test.sh

# Created by https://www.gitignore.io/api/go,linux,macos,windows,visualstudiocode
Expand Down
6 changes: 5 additions & 1 deletion server/api-post-repo-select.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"net/http"

"github.com/ItalyPaleAle/prvt/fs"
"github.com/ItalyPaleAle/prvt/index"

"github.com/gin-gonic/gin"
)

Expand Down Expand Up @@ -66,13 +68,15 @@ func (s *Server) PostRepoSelectHandler(c *gin.Context) {
// Note that the repo is still locked at this stage
s.Store = store
s.Infofile = info
s.Repo = nil
index.Instance.SetStore(store)

// Response
repoId := s.Infofile.RepoId
if repoId == "" {
repoId = "(Repository ID missing)"
}
fmt.Println("Selected repository", repoId)
fmt.Println("Selected repository:", repoId)
c.JSON(http.StatusOK, struct {
Repo string `json:"id"`
}{
Expand Down

0 comments on commit 99b9dd8

Please sign in to comment.