Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# endpoint for API
NUXT_PUBLIC_COMMUNITY_API_URL=
NUXT_PUBLIC_AUTH_BASE_URL=
NUXT_API_PARTY_ENDPOINTS_API_URL=http://localhost:5000/v2
NUXT_PUBLIC_COMMUNITY_API_URL=http://localhost:5000/v2
NUXT_PUBLIC_AUTH_BASE_URL=http://localhost:5000/auth
NUXT_PUBLIC_TARGET_ENV=
NUXT_PUBLIC_BUILD_COMMIT_SHA=
NUXT_PUBLIC_BUILD_NUMBER=
Expand All @@ -9,4 +10,3 @@ NUXT_PUBLIC_BUILD_COMMIT_LINK=
NUXT_PUBLIC_BUILD_REPO_LINK=
NUXT_PUBLIC_BUILD_TIMESTAMP=
NUXT_PUBLIC_DEBUG=
NUXT_PUBLIC_SESSION_COOKIE_NAME=
21 changes: 0 additions & 21 deletions .eslintrc.js

This file was deleted.

4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.nuxt
dist
build
4 changes: 0 additions & 4 deletions .prettierrc

This file was deleted.

6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"singleQuote": true,
"tabWidth": 2,
"vueIndentScriptAndStyle": true
}
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ ARG USER=node DRONE_COMMIT_SHA=${DRONE_COMMIT_SHA} DRONE_BUILD_NUMBER=${DRONE_BU
###########
# BUILDER #
###########
FROM node:18.14.0 AS builder

FROM node:22.15.0 AS builder

# copy build context and install dependencinpm res
WORKDIR /workspace
Expand All @@ -18,7 +17,7 @@ RUN npm run build
###########
# PROJECT #
###########
FROM node:18-slim
FROM node:22-slim

# pass the global args
ARG USER
Expand All @@ -44,4 +43,4 @@ ENV NUXT_PUBLIC_BUILD_COMMIT_SHA=${DRONE_COMMIT_SHA} NUXT_PUBLIC_BUILD_NUMBER=${
EXPOSE ${PORT}

# run for production
CMD [ "node", "/app/.output/server/index.mjs"]
CMD [ "node", "/app/.output/server/index.mjs"]
4 changes: 2 additions & 2 deletions components/Form/AppDropDownSearch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ const props = defineProps({
})

const onSubmit = async () => {
await fetch(
`${config.public.communityApiUrl}/member/search?q=${state.searchQuery}`
await $api(
`/member/search?q=${state.searchQuery}`
)
.then((response) => response.json())
.then((data) => {
Expand Down
134 changes: 74 additions & 60 deletions components/login/Form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
class="mb-4"
:show-close-btn="false"
>
The email and password you entered did not match our records. Please
double-check and try again.
<span class="text-community-blue"
>Error Status code: {{ state.errorCode }}</span
>
<br />
<span v-if="state.errorMessage"> {{ state.errorMessage }}</span>
<span v-else>
An unexpected error occurred. Please try again later.
</span>
</Message>
<form @submit.prevent="login">
<FormAppControlInput
Expand Down Expand Up @@ -46,67 +52,75 @@
</div>
</template>
<script setup>
const emit = defineEmits(['forgotPassword'])
const { data, signIn } = useAuth()
const emit = defineEmits(['forgotPassword'])

const form = reactive({
email: '',
password: '',
})
const state = reactive({
loading: false,
error: false,
})
const login = async () => {
state.error = false
state.loading = true
const { refresh } = useAuth()
const form = reactive({
email: '',
password: '',
})
const state = reactive({
loading: false,
error: false,
errorMessage: '',
errorCode: '',
})
const login = async () => {
state.error = false
state.loading = true

await signIn(
{
email: form.email,
password: form.password,
},
{
callbackUrl: '/',
},
)
.catch((error) => {
console.error('Error while signing in: ', error)
state.error = true
})
.finally(async () => {
const member = data.value
if (member?.id && member.username === form.email) {
console.info(`${member.username} is logged in!`)
updateUserId(member.id)
isAuth().value = true
await useFetchMember()
}
state.loading = false
await $fetch('/api/auth/login', {
method: 'POST',
body: JSON.stringify({
email: form.email,
password: form.password,
}),
})
}
.then(async (response) => {
const memberSession = response.session
if (memberSession?.id && memberSession.username === form.email) {
await updateUserId(memberSession.id)
// Refresh Nuxt Auth state to sync with cookies
await refresh()
await useFetchMember(memberSession.id)
// NOTE: External navigation is required to avoid issues with Nuxt's internal routing for full reload behavior
await navigateTo(response.redirectTo || '/', { external: true })

}
})
.catch((error) => {
console.error('Error [AUTH | LOGIN]:', error.status, error.message)
state.errorCode = error.status
state.errorMessage =
error.message.split(':')[1]?.trim() || 'Login failed'
state.error = true
})
.finally(async () => {
state.loading = false
})
}
</script>
<style lang="postcss" scoped>
.divider-slashes {
@apply mt-5 mb-10;
@apply h-3;
}
div.container {
@apply bg-white;
@apply my-5 md:my-10;
@apply p-5 md:p-10;
@apply rounded-lg;
@apply md:text-lg;
max-width: 480px;
}
.form-submit {
@apply w-full;
@apply rounded-lg;
}
form a {
@apply block w-full;
@apply text-right;
@apply text-community-blue;
@apply mb-10;
}
.divider-slashes {
@apply mt-5 mb-10;
@apply h-3;
}
div.container {
@apply bg-white;
@apply my-5 md:my-10;
@apply p-5 md:p-10;
@apply rounded-lg;
@apply md:text-lg;
max-width: 480px;
}
.form-submit {
@apply w-full;
@apply rounded-lg;
}
form a {
@apply block w-full;
@apply text-right;
@apply text-community-blue;
@apply mb-10;
}
</style>
4 changes: 2 additions & 2 deletions components/member/Banner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ const uploadImage = async (event, imageType) => {
const { files } = await event.target
const image = new FormData()
image.append('file', files[0], files[0].name)
await fetch(
`${config.public.communityApiUrl}/upload/members/${imageType}/${
await $api(
`/upload/members/${imageType}/${
userId().value
}`,
{
Expand Down
2 changes: 1 addition & 1 deletion components/member/Experience.vue
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ const addMemberEducation = async () => {
method: 'POST',
body: JSON.stringify(bodyData),
onResponse({ response }) {
if (response._data.success) {
if (response.ok) {
state.error = false
state.success = true
state.loading = false
Expand Down
Loading