From d0e52ddfa6804068a42aa43fd64f4808a8619bfa Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Tue, 18 Jan 2022 13:29:51 +0000 Subject: [PATCH] Implement basic routing --- http/dashboard.go | 2 +- web/package.json | 2 +- web/src/App.vue | 4 ++-- web/src/components/HelloWorld.vue | 8 -------- web/src/main.js | 4 +++- web/src/pages/Dashboard.vue | 34 +++++++++++++++++++++++++++++++ web/src/router/index.js | 15 ++++++++++++++ web/yarn.lock | 15 ++++++++++---- 8 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 web/src/pages/Dashboard.vue create mode 100644 web/src/router/index.js diff --git a/http/dashboard.go b/http/dashboard.go index 8e13108..f752b10 100644 --- a/http/dashboard.go +++ b/http/dashboard.go @@ -18,7 +18,7 @@ func (h *Handler) dashboard(c *gin.Context) { d := DashboardData{ Budgets: budgets, } - c.HTML(http.StatusOK, "dashboard.html", d) + c.JSON(http.StatusOK, d) } type DashboardData struct { diff --git a/web/package.json b/web/package.json index 21e4c63..1d9b41d 100644 --- a/web/package.json +++ b/web/package.json @@ -8,7 +8,7 @@ }, "dependencies": { "vue": "^3.2.25", - "vue-router": "^3.5.3" + "vue-router": "4" }, "devDependencies": { "@vitejs/plugin-vue": "^2.0.0", diff --git a/web/src/App.vue b/web/src/App.vue index 7422330..61d3df4 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -1,12 +1,12 @@