diff --git a/app/components/content/auth/login.vue b/app/components/content/auth/login.vue index c933b813..0e581ca9 100644 --- a/app/components/content/auth/login.vue +++ b/app/components/content/auth/login.vue @@ -2,8 +2,8 @@ import { z } from 'zod' const loginSchema = z.object({ - name: z.string().min(6, 'Please enter a valid username'), - password: z.string().min(6, 'Password must be at least 6 characters'), + name: z.string().min(3, 'Please enter a valid username'), + password: z.string().min(3, 'Password must be at least 3 characters'), }) const { login } = useUserStore() diff --git a/nuxt.config.ts b/nuxt.config.ts index 9aa570ee..8176a4fb 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,17 +1,14 @@ -import { config as dotenvConfig } from 'dotenv' import process from 'node:process' -dotenvConfig() - -console.log(process.env.API_ORIGIN) -console.log(process.env.NUXT_PUBLIC_SIMRS_USER_API_URL) - // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ devtools: { enabled: true }, runtimeConfig: { - API_ORIGIN: process.env.API_ORIGIN || 'https://main-api.dev-hopis.sabbi.id', + API_ORIGIN: process.env.NUXT_API_ORIGIN || 'https://main-api.dev-hopis.sabbi.id', + public: { + API_ORIGIN: process.env.NUXT_API_ORIGIN || 'https://main-api.dev-hopis.sabbi.id', + } }, ssr: false, diff --git a/package.json b/package.json index 2aee9ea2..d415abde 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "@unovis/ts": "^1.5.1", "@unovis/vue": "^1.5.1", "date-fns": "^4.1.0", - "dotenv": "^17.2.2", "embla-carousel": "^8.5.2", "embla-carousel-vue": "^8.5.2", "h3": "^1.15.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 59bdc0ac..c450fd37 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,9 +26,6 @@ dependencies: date-fns: specifier: ^4.1.0 version: 4.1.0 - dotenv: - specifier: ^17.2.2 - version: 17.2.2 embla-carousel: specifier: ^8.5.2 version: 8.6.0 diff --git a/server/api/[...req].ts b/server/api/[...req].ts index 841378fd..8404cc2a 100644 --- a/server/api/[...req].ts +++ b/server/api/[...req].ts @@ -1,4 +1,3 @@ -import process from 'node:process' import { defineEventHandler, getCookie, getRequestHeaders, getRequestURL, readBody } from 'h3' export default defineEventHandler(async (event) => { @@ -7,7 +6,7 @@ export default defineEventHandler(async (event) => { const url = getRequestURL(event) const config = useRuntimeConfig() - const apiOrigin = config.API_ORIGIN + const apiOrigin = config.public.API_ORIGIN const pathname = url.pathname.replace(/^\/api/, '') const targetUrl = apiOrigin + pathname + (url.search || '') @@ -36,8 +35,6 @@ export default defineEventHandler(async (event) => { } } - console.log(targetUrl) - const res = await fetch(targetUrl, { method, headers: forwardHeaders, diff --git a/server/api/v1/authentication/login.post.ts b/server/api/v1/authentication/login.post.ts index 8a096ab5..758c7925 100644 --- a/server/api/v1/authentication/login.post.ts +++ b/server/api/v1/authentication/login.post.ts @@ -1,4 +1,3 @@ -import { useRuntimeConfig } from '#imports' import { getRequestURL, readBody, setCookie } from 'h3' export default defineEventHandler(async (event) => { @@ -6,8 +5,7 @@ export default defineEventHandler(async (event) => { const url = getRequestURL(event) const config = useRuntimeConfig() - const apiOrigin = config.API_ORIGIN - + const apiOrigin = config.public.API_ORIGIN const externalUrl = apiOrigin + url.pathname.replace(/^\/api/, '') + url.search const resp = await fetch(externalUrl, {