From 13fd22225fc34af1d7f749e1c17f26927c752e2e Mon Sep 17 00:00:00 2001 From: Jakob Mueller Date: Sat, 16 Mar 2024 11:37:56 +0100 Subject: [PATCH] Update python, fix login bug --- .github/workflows/buld.yml | 4 ---- backend/docker/dev-app.Dockerfile | 2 +- backend/docker/prod-app.Dockerfile | 2 +- frontend/src/App.vue | 5 +++++ frontend/src/services/AuthService.ts | 11 ++++++++++- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/buld.yml b/.github/workflows/buld.yml index e52675f..e2fadb7 100644 --- a/.github/workflows/buld.yml +++ b/.github/workflows/buld.yml @@ -27,10 +27,6 @@ jobs: username: ${{ github.actor }} password: ${{ github.token }} - - name: Set correct permissions - working-directory: ./backend - run: sudo chmod -R a+rw . - - name: Build the Docker image working-directory: ./backend run: docker build -f docker/prod-app.Dockerfile -t ghcr.io/agdsn/keywi:${GITHUB_REF_NAME} . diff --git a/backend/docker/dev-app.Dockerfile b/backend/docker/dev-app.Dockerfile index 24567e8..d139385 100644 --- a/backend/docker/dev-app.Dockerfile +++ b/backend/docker/dev-app.Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10 +FROM python:3.12 ARG UID=1000 ARG GID=1000 diff --git a/backend/docker/prod-app.Dockerfile b/backend/docker/prod-app.Dockerfile index 43565c2..c382257 100644 --- a/backend/docker/prod-app.Dockerfile +++ b/backend/docker/prod-app.Dockerfile @@ -1,4 +1,4 @@ -FROM python:3.10 +FROM python:3.12 ARG UID=1000 ARG GID=1000 diff --git a/frontend/src/App.vue b/frontend/src/App.vue index c3fdd91..3eaa925 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -12,6 +12,7 @@ diff --git a/frontend/src/services/AuthService.ts b/frontend/src/services/AuthService.ts index 8706b74..99c0fed 100644 --- a/frontend/src/services/AuthService.ts +++ b/frontend/src/services/AuthService.ts @@ -65,6 +65,15 @@ export default { isLoggedIn() { return localStorage.getItem('access_token') != null; }, + async refreshUser() { + const apiClient = await api; + + apiClient.user_getCurrent().then((response) => { + localStorage.setItem('user', JSON.stringify(response.data)); + }).catch(() => { + this.logout(); + }); + }, getUser() { const userData = localStorage.getItem('user'); @@ -74,4 +83,4 @@ export default { return JSON.parse(userData); } -} \ No newline at end of file +}