From fd0fc20b7d973de3e4e227afc2ab84e599e42303 Mon Sep 17 00:00:00 2001 From: Edd Date: Thu, 15 Jan 2026 23:26:14 +0000 Subject: [PATCH 1/2] login functionality + home page mock --- app/app.vue | 6 +- app/assets/css/tailwind.css | 2 +- app/layouts/default.vue | 68 +++++++++++++++++ app/pages/auth-test.vue | 84 +++++++++++++++++++++ app/pages/auth/login.vue | 147 ++++++++++++++++++++++++++++++++++++ app/pages/index.vue | 48 +++++++++++- app/stores/auth-store.js | 42 +++++++++++ nuxt.config.ts | 30 +++----- package.json | 2 + 9 files changed, 401 insertions(+), 28 deletions(-) create mode 100644 app/layouts/default.vue create mode 100644 app/pages/auth-test.vue create mode 100644 app/pages/auth/login.vue create mode 100644 app/stores/auth-store.js diff --git a/app/app.vue b/app/app.vue index fc2270b..f8eacfa 100644 --- a/app/app.vue +++ b/app/app.vue @@ -1,5 +1,5 @@ diff --git a/app/assets/css/tailwind.css b/app/assets/css/tailwind.css index f1fc49c..15c68bb 100644 --- a/app/assets/css/tailwind.css +++ b/app/assets/css/tailwind.css @@ -1,7 +1,7 @@ @import "tailwindcss"; @import "tw-animate-css"; -@custom-variant dark (&:is(.dark *)); +@custom-variant dark (&:where(.dark, .dark *)); @theme inline { --radius-sm: calc(var(--radius) - 4px); diff --git a/app/layouts/default.vue b/app/layouts/default.vue new file mode 100644 index 0000000..b0fbd8d --- /dev/null +++ b/app/layouts/default.vue @@ -0,0 +1,68 @@ + + diff --git a/app/pages/auth-test.vue b/app/pages/auth-test.vue new file mode 100644 index 0000000..a4bf2ed --- /dev/null +++ b/app/pages/auth-test.vue @@ -0,0 +1,84 @@ + + diff --git a/app/pages/auth/login.vue b/app/pages/auth/login.vue new file mode 100644 index 0000000..545ad25 --- /dev/null +++ b/app/pages/auth/login.vue @@ -0,0 +1,147 @@ + + + + \ No newline at end of file diff --git a/app/pages/index.vue b/app/pages/index.vue index 1e11da8..9b7905c 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -1,5 +1,47 @@ + \ No newline at end of file diff --git a/app/stores/auth-store.js b/app/stores/auth-store.js new file mode 100644 index 0000000..1db925e --- /dev/null +++ b/app/stores/auth-store.js @@ -0,0 +1,42 @@ +import { defineStore } from "pinia"; + +export const useAuthStore = defineStore("authStore", () => { + const token = useCookie("auth_token", { maxAge: 60 * 15 }); + const user = useCookie("auth_user", { maxAge: 60 * 15 }); + + if (process.client) { + token.value = localStorage.getItem("auth_token"); + + const savedUser = localStorage.getItem("auth_user"); + if (savedUser) { + try { + user.value = JSON.parse(savedUser); + } catch (e) { + console.error("Failed to parse user from storage", e); + } + } + } + + watch([token, user], ([newToken, newUser]) => { + if (!process.client) return; + + if (newToken) { + localStorage.setItem("auth_token", newToken); + } else { + localStorage.removeItem("auth_token"); + } + + if (newUser) { + localStorage.setItem("auth_user", JSON.stringify(newUser)); + } else { + localStorage.removeItem("auth_user"); + } + }, { deep: true }); + + function logout() { + token.value = null; + user.value = null; + } + + return { token, user, logout }; +}); \ No newline at end of file diff --git a/nuxt.config.ts b/nuxt.config.ts index b9d1747..2d111ff 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,32 +1,20 @@ import tailwindcss from "@tailwindcss/vite"; -// https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ - compatibilityDate: "2025-07-15", + compatibilityDate: "2026-01-01", devtools: { enabled: true }, css: ["~/assets/css/tailwind.css"], + vite: { plugins: [tailwindcss()], }, - modules: [ - "@nuxt/fonts", - "@nuxt/icon", - "@nuxt/image", - "@nuxt/eslint", - "shadcn-nuxt", - ], - - shadcn: { - /** - * Prefix for all the imported component - */ - prefix: "", - /** - * Directory that the component lives in. - * @default "./app/components/ui" - */ - componentDir: "./app/components/ui", + runtimeConfig: { + public: { + apiBase: "http://localhost:8080/academics/api/v1", + }, }, -}); + + modules: ["@pinia/nuxt"], +}); \ No newline at end of file diff --git a/package.json b/package.json index 9f6b78c..c0d7953 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,9 @@ "clsx": "^2.1.1", "eslint": "^9.39.0", "lucide-vue-next": "^0.552.0", + "@pinia/nuxt": "0.11.3", "nuxt": "^4.2.0", + "pinia": "^3.0.4", "reka-ui": "^2.6.0", "shadcn-nuxt": "^2.3.2", "tailwind-merge": "^3.3.1", From 85acc051b1a40fc719fa7b68bde86927176b43fd Mon Sep 17 00:00:00 2001 From: AfonsoCMSousa Date: Fri, 16 Jan 2026 18:08:31 +0000 Subject: [PATCH 2/2] fix: smth to do with the pakages --- package-lock.json | 89 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 68 insertions(+), 21 deletions(-) diff --git a/package-lock.json b/package-lock.json index e35c619..4b7701f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,7 @@ "@nuxt/fonts": "^0.11.4", "@nuxt/icon": "^2.1.0", "@nuxt/image": "^1.11.0", + "@pinia/nuxt": "0.11.3", "@tailwindcss/vite": "^4.1.16", "@vueuse/core": "^14.0.0", "class-variance-authority": "^0.7.1", @@ -18,6 +19,7 @@ "eslint": "^9.39.0", "lucide-vue-next": "^0.552.0", "nuxt": "^4.2.0", + "pinia": "^3.0.4", "reka-ui": "^2.6.0", "shadcn-nuxt": "^2.3.2", "tailwind-merge": "^3.3.1", @@ -3439,6 +3441,21 @@ "url": "https://opencollective.com/parcel" } }, + "node_modules/@pinia/nuxt": { + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/@pinia/nuxt/-/nuxt-0.11.3.tgz", + "integrity": "sha512-7WVNHpWx4qAEzOlnyrRC88kYrwnlR/PrThWT0XI1dSNyUAXu/KBv9oR37uCgYkZroqP5jn8DfzbkNF3BtKvE9w==", + "license": "MIT", + "dependencies": { + "@nuxt/kit": "^4.2.0" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "pinia": "^3.0.4" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -5106,12 +5123,12 @@ } }, "node_modules/@vue/devtools-kit": { - "version": "7.7.7", - "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.7.tgz", - "integrity": "sha512-wgoZtxcTta65cnZ1Q6MbAfePVFxfM+gq0saaeytoph7nEa7yMXoi6sCPy4ufO111B9msnw0VOWjPEFCXuAKRHA==", + "version": "7.7.9", + "resolved": "https://registry.npmjs.org/@vue/devtools-kit/-/devtools-kit-7.7.9.tgz", + "integrity": "sha512-PyQ6odHSgiDVd4hnTP+aDk2X4gl2HmLDfiyEnn3/oV+ckFDuswRs4IbBT7vacMuGdwY/XemxBoh302ctbsptuA==", "license": "MIT", "dependencies": { - "@vue/devtools-shared": "^7.7.7", + "@vue/devtools-shared": "^7.7.9", "birpc": "^2.3.0", "hookable": "^5.5.3", "mitt": "^3.0.1", @@ -5127,9 +5144,9 @@ "license": "MIT" }, "node_modules/@vue/devtools-shared": { - "version": "7.7.7", - "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.7.tgz", - "integrity": "sha512-+udSj47aRl5aKb0memBvcUG9koarqnxNM5yjuREvqwK6T3ap4mn3Zqqc17QrBFTqSMjr3HK1cvStEZpMDpfdyw==", + "version": "7.7.9", + "resolved": "https://registry.npmjs.org/@vue/devtools-shared/-/devtools-shared-7.7.9.tgz", + "integrity": "sha512-iWAb0v2WYf0QWmxCGy0seZNDPdO3Sp5+u78ORnyeonS6MT4PC7VPrryX2BpMJrwlDeaZ6BD4vP4XKjK0SZqaeA==", "license": "MIT", "dependencies": { "rfdc": "^1.4.1" @@ -7006,9 +7023,9 @@ } }, "node_modules/devalue": { - "version": "5.4.2", - "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.4.2.tgz", - "integrity": "sha512-MwPZTKEPK2k8Qgfmqrd48ZKVvzSQjgW0lXLxiIBA8dQjtf/6mw6pggHNLcyDKyf+fI6eXxlQwPsfaCMTU5U+Bw==", + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/devalue/-/devalue-5.6.2.tgz", + "integrity": "sha512-nPRkjWzzDQlsejL1WVifk5rvcFi/y1onBRxjaFMjZeR9mFpqu2gmAZ9xUB9/IEanEP/vBtGeGganC/GO1fmufg==", "license": "MIT" }, "node_modules/dfa": { @@ -8409,9 +8426,9 @@ } }, "node_modules/h3": { - "version": "1.15.4", - "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.4.tgz", - "integrity": "sha512-z5cFQWDffyOe4vQ9xIqNfCZdV4p//vy6fBnr8Q1AWnVZ0teurKMG66rLj++TKwKPUP3u7iMUvrvKaEUiQw2QWQ==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/h3/-/h3-1.15.5.tgz", + "integrity": "sha512-xEyq3rSl+dhGX2Lm0+eFQIAzlDN6Fs0EcC4f7BNUmzaRX/PTzeuM+Tr2lHB8FoXggsQIeXLj8EDVgs5ywxyxmg==", "license": "MIT", "dependencies": { "cookie-es": "^1.2.2", @@ -8419,9 +8436,9 @@ "defu": "^6.1.4", "destr": "^2.0.5", "iron-webcrypto": "^1.2.1", - "node-mock-http": "^1.0.2", + "node-mock-http": "^1.0.4", "radix3": "^1.1.2", - "ufo": "^1.6.1", + "ufo": "^1.6.3", "uncrypto": "^0.1.3" } }, @@ -10181,9 +10198,9 @@ } }, "node_modules/node-mock-http": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/node-mock-http/-/node-mock-http-1.0.3.tgz", - "integrity": "sha512-jN8dK25fsfnMrVsEhluUTPkBFY+6ybu7jSB1n+ri/vOGjJxU8J9CZhpSGkHXSkFjtUhbmoncG/YG9ta5Ludqog==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/node-mock-http/-/node-mock-http-1.0.4.tgz", + "integrity": "sha512-8DY+kFsDkNXy1sJglUfuODx1/opAGJGyrTuFqEoN90oRc2Vk0ZbD4K2qmKXBBEhZQzdKHIVfEJpDU8Ak2NJEvQ==", "license": "MIT" }, "node_modules/node-releases": { @@ -10814,6 +10831,36 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pinia": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-3.0.4.tgz", + "integrity": "sha512-l7pqLUFTI/+ESXn6k3nu30ZIzW5E2WZF/LaHJEpoq6ElcLD+wduZoB2kBN19du6K/4FDpPMazY2wJr+IndBtQw==", + "license": "MIT", + "dependencies": { + "@vue/devtools-api": "^7.7.7" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "typescript": ">=4.5.0", + "vue": "^3.5.11" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/pinia/node_modules/@vue/devtools-api": { + "version": "7.7.9", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-7.7.9.tgz", + "integrity": "sha512-kIE8wvwlcZ6TJTbNeU2HQNtaxLx3a84aotTITUuL/4bzfPxzajGBOoqjMhwZJ8L9qFYDU/lAYMEEm11dnZOD6g==", + "license": "MIT", + "dependencies": { + "@vue/devtools-kit": "^7.7.9" + } + }, "node_modules/pkg-types": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.3.0.tgz", @@ -13273,9 +13320,9 @@ } }, "node_modules/ufo": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", - "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.3.tgz", + "integrity": "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==", "license": "MIT" }, "node_modules/ultrahtml": {