Skip to content

Commit

Permalink
fix: startpage bookmark bug
Browse files Browse the repository at this point in the history
  • Loading branch information
toboshii committed Oct 2, 2022
1 parent ef54a56 commit 49f5e77
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ deps: ## Install required dependencies
cd frontend/ && npm install

.PHONY: build
build: ## Build the Go project.
build: ## Build the project
npm run build --prefix frontend/
go build -ldflags="-s -w" -trimpath -o ./bin/hajimari ./cmd/hajimari/main.go

Expand All @@ -19,8 +19,16 @@ run: build ## Run the program
./bin/hajimari

.PHONY: dev
dev: ## Run the program in dev mode
(trap 'kill 0' SIGINT; air & sleep 5 && cd frontend/ && npm run dev -- --open)
dev: ## Run the frontend & backend in dev mode
make -j 2 dev-backend dev-frontend

.PHONY: dev-backend
dev-backend: ## Run the backend in dev mode
air &

.PHONY: dev-frontend
dev-frontend: ## Run the frontend in dev mode
cd frontend/ && sleep 3 && npm run dev -- --open

.PHONY: fmt
fmt: ## Format the project with gofmt
Expand Down
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ node_modules
!.env.example
.vercel
.output
.vite
5 changes: 5 additions & 0 deletions internal/handlers/startpage.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func (sr *startpageResource) StartpageCtx(next http.Handler) http.Handler {

func (sr *startpageResource) GetStartpage(w http.ResponseWriter, r *http.Request) {
startpage := r.Context().Value(contextKeyStartpage).(*models.Startpage)

if len(startpage.Bookmarks) == 0 {
startpage.Bookmarks = []models.BookmarkGroup{}
}

appConfig, err := config.GetConfig()
if err != nil {
logger.Error("Failed to read configuration for hajimari: ", err)
Expand Down

0 comments on commit 49f5e77

Please sign in to comment.