Skip to content
Snippets Groups Projects
Commit 88992f0a authored by Trygve Jørgensen's avatar Trygve Jørgensen
Browse files

chore: removed logging and renamed all instances of x-name to x-Name

parent 17418764
No related branches found
No related tags found
3 merge requests!66Final merge,!52Change password and routing fix,!4Pipeline fix
...@@ -385,7 +385,6 @@ const targetRef = ref<HTMLElement | null>(null) ...@@ -385,7 +385,6 @@ const targetRef = ref<HTMLElement | null>(null)
// AddSpareUtfordring // AddSpareUtfordring
const addSpareUtfordring = () => { const addSpareUtfordring = () => {
console.log('Attempting to navigate to /spareutfordringer')
router.push('/spareutfordringer').catch((error) => { router.push('/spareutfordringer').catch((error) => {
console.error('Routing error:', error) console.error('Routing error:', error)
}) })
...@@ -444,11 +443,9 @@ const loadAnimatedStates = () => { ...@@ -444,11 +443,9 @@ const loadAnimatedStates = () => {
} }
const saveAnimatedState = (challenge: Challenge) => { const saveAnimatedState = (challenge: Challenge) => {
console.log('Saving animated state for 1:', challenge.id)
if (challenge.id != null) { if (challenge.id != null) {
animatedChallenges.value.push(challenge.id) animatedChallenges.value.push(challenge.id)
} }
console.log('Saving animated state for:', challenge.title)
localStorage.setItem('animatedChallenges', JSON.stringify(animatedChallenges.value)) localStorage.setItem('animatedChallenges', JSON.stringify(animatedChallenges.value))
} }
...@@ -457,7 +454,6 @@ const animateChallenge = (challenge: Challenge) => { ...@@ -457,7 +454,6 @@ const animateChallenge = (challenge: Challenge) => {
challenge.completion === 100 && challenge.completion === 100 &&
!animatedChallenges.value.includes(challenge.id as number) !animatedChallenges.value.includes(challenge.id as number)
) { ) {
console.log('Animating for:', challenge.title)
if (challenge.id != null) { if (challenge.id != null) {
animatedChallenges.value.push(challenge.id) animatedChallenges.value.push(challenge.id)
} // Ensure no duplication } // Ensure no duplication
...@@ -483,8 +479,6 @@ watch( ...@@ -483,8 +479,6 @@ watch(
nextTick(() => { nextTick(() => {
if (challenge.completion === 100) { if (challenge.completion === 100) {
if (!animatedChallenges.value.includes(challenge.id as number)) { if (!animatedChallenges.value.includes(challenge.id as number)) {
console.log(!animatedChallenges.value.includes(challenge.id as number))
console.log('Animating challenge in watcher:', challenge.id)
animateChallenge(challenge) animateChallenge(challenge)
saveAnimatedState(challenge) // Refactor this to update localStorage correctly saveAnimatedState(challenge) // Refactor this to update localStorage correctly
} }
......
...@@ -163,23 +163,23 @@ router.beforeEach(async (to, from, next) => { ...@@ -163,23 +163,23 @@ router.beforeEach(async (to, from, next) => {
if (!loginCredentials) { if (!loginCredentials) {
if (bioCredentials && to.name !== 'login-bio') { if (bioCredentials && to.name !== 'login-bio') {
console.log('Bio login')
await router.replace({ name: 'login-bio', params: { username: bioCredentials } }) await router.replace({ name: 'login-bio', params: { username: bioCredentials } })
return next({ name: 'login-bio', params: { username: bioCredentials } }) return next({ name: 'login-bio', params: { username: bioCredentials } })
} else if (authRequired && !bioCredentials && to.name !== 'login') { } else if (authRequired && !bioCredentials && to.name !== 'login') {
console.log('Normal login')
await router.replace({ name: 'login' }) await router.replace({ name: 'login' })
return next({ name: 'login' }) return next({ name: 'login' })
} else if (!authRequired) { } else if (!authRequired) {
console.log('Public page')
next() next()
} }
} else { } else {
if (userStore.user.isConfigured == false) { console.log('Logged in')
if (!userStore.user.isConfigured) {
await userStore.checkIfUserConfigured() await userStore.checkIfUserConfigured()
} }
const isConfigured = userStore.user.isConfigured const isConfigured = userStore.user.isConfigured
console.log('Is configured:', isConfigured)
if (configRequired && !isConfigured) { if (configRequired && !isConfigured) {
await router.replace({ name: 'configure-biometric' }) await router.replace({ name: 'configure-biometric' })
......
...@@ -12,10 +12,8 @@ export const useChallengeStore = defineStore('challenge', () => { ...@@ -12,10 +12,8 @@ export const useChallengeStore = defineStore('challenge', () => {
const response = await authInterceptor('/challenges') const response = await authInterceptor('/challenges')
if (response.data && response.data.content) { if (response.data && response.data.content) {
challenges.value = response.data.content challenges.value = response.data.content
console.log('Fetched Challenges:', challenges.value)
} else { } else {
challenges.value = [] challenges.value = []
console.error('No challenge content found:', response.data)
} }
} catch (error) { } catch (error) {
console.error('Error fetching challenges:', error) console.error('Error fetching challenges:', error)
...@@ -32,10 +30,7 @@ export const useChallengeStore = defineStore('challenge', () => { ...@@ -32,10 +30,7 @@ export const useChallengeStore = defineStore('challenge', () => {
const index = challenges.value.findIndex((c) => c.id === challenge.id) const index = challenges.value.findIndex((c) => c.id === challenge.id)
if (index !== -1) { if (index !== -1) {
challenges.value[index] = { ...challenges.value[index], ...response.data } challenges.value[index] = { ...challenges.value[index], ...response.data }
console.log('Updated Challenge:', response.data)
} }
} else {
console.error('No challenge content found in response data')
} }
} catch (error) { } catch (error) {
console.error('Error updating challenge:', error) console.error('Error updating challenge:', error)
...@@ -52,7 +47,6 @@ export const useChallengeStore = defineStore('challenge', () => { ...@@ -52,7 +47,6 @@ export const useChallengeStore = defineStore('challenge', () => {
const index = challenges.value.findIndex((c) => c.id === challenge.id) const index = challenges.value.findIndex((c) => c.id === challenge.id)
if (index !== -1) { if (index !== -1) {
challenges.value[index] = { ...challenges.value[index], ...response.data } challenges.value[index] = { ...challenges.value[index], ...response.data }
console.log('Updated Challenge:', response.data)
} }
} else { } else {
console.error('No challenge content found in response data') console.error('No challenge content found in response data')
......
...@@ -10,11 +10,8 @@ export const useGoalStore = defineStore('goal', () => { ...@@ -10,11 +10,8 @@ export const useGoalStore = defineStore('goal', () => {
const response = await authInterceptor('/goals') const response = await authInterceptor('/goals')
if (response.data && response.data.content) { if (response.data && response.data.content) {
goals.value = response.data.content goals.value = response.data.content
console.log(response.data.content)
console.log('Fetched Goals:', goals.value)
} else { } else {
goals.value = [] goals.value = []
console.error('No goal content found:', response.data)
} }
} catch (error) { } catch (error) {
console.error('Error fetching challenges:', error) console.error('Error fetching challenges:', error)
...@@ -34,7 +31,6 @@ export const useGoalStore = defineStore('goal', () => { ...@@ -34,7 +31,6 @@ export const useGoalStore = defineStore('goal', () => {
const index = goals.value.findIndex((g) => g.id === goal.id) const index = goals.value.findIndex((g) => g.id === goal.id)
if (index !== -1) { if (index !== -1) {
goals.value[index] = { ...goals.value[index], ...response.data } goals.value[index] = { ...goals.value[index], ...response.data }
console.log('Updated Goal:', response.data)
} }
} else { } else {
console.error('No goal content found in response data') console.error('No goal content found in response data')
......
...@@ -46,18 +46,12 @@ export const useUserConfigStore = defineStore('userConfig', () => { ...@@ -46,18 +46,12 @@ export const useUserConfigStore = defineStore('userConfig', () => {
accNumber, accNumber,
balance balance
} }
await authInterceptor await authInterceptor.post('/accounts', payload).catch((error) => {
.post('/accounts', payload) const axiosError = error as AxiosError
.then((response) => { errorMessage.value =
console.log('Success:', response.data) (axiosError.response?.data as string) || 'An error occurred while posting account'
}) console.error('Error posting account:', errorMessage.value)
.catch((error) => { })
const axiosError = error as AxiosError
errorMessage.value =
(axiosError.response?.data as string) ||
'An error occurred while posting account'
console.error('Error posting account:', errorMessage.value)
})
} }
const postUserConfig = async () => { const postUserConfig = async () => {
...@@ -66,18 +60,13 @@ export const useUserConfigStore = defineStore('userConfig', () => { ...@@ -66,18 +60,13 @@ export const useUserConfigStore = defineStore('userConfig', () => {
motivation: motivation.value, motivation: motivation.value,
challengeTypeConfigs: Array.from(challengeTypeConfigs.value) challengeTypeConfigs: Array.from(challengeTypeConfigs.value)
} }
await authInterceptor await authInterceptor.post('/config/challenge', payload).catch((error) => {
.post('/config/challenge', payload) const axiosError = error as AxiosError
.then((response) => { errorMessage.value =
console.log('Success:', response.data) (axiosError.response?.data as string) ||
}) 'An error occurred while updating configuration'
.catch((error) => { console.error('Error updating configuration:', errorMessage.value)
const axiosError = error as AxiosError })
errorMessage.value =
(axiosError.response?.data as string) ||
'An error occurred while updating configuration'
console.error('Error updating configuration:', errorMessage.value)
})
} }
return { return {
......
...@@ -79,7 +79,6 @@ onMounted(async () => { ...@@ -79,7 +79,6 @@ onMounted(async () => {
challenges.value = challengeStore.challenges challenges.value = challengeStore.challenges
goals.value = goalStore.goals goals.value = goalStore.goals
goal.value = goals.value[0] goal.value = goals.value[0]
console.log('Goals:', goals.value)
const lastModalShow = localStorage.getItem('lastModalShow') const lastModalShow = localStorage.getItem('lastModalShow')
if (!lastModalShow || Date.now() - Number(lastModalShow) >= 24 * 60 * 60 * 1000) { if (!lastModalShow || Date.now() - Number(lastModalShow) >= 24 * 60 * 60 * 1000) {
......
...@@ -85,10 +85,9 @@ onMounted(() => { ...@@ -85,10 +85,9 @@ onMounted(() => {
authInterceptor('/config/challenge') authInterceptor('/config/challenge')
.then((response) => { .then((response) => {
configuration.value = response.data configuration.value = response.data
console.log(configuration.value)
}) })
.catch((error) => { .catch((error) => {
return console.log(error) console.error(error)
}) })
}) })
</script> </script>
......
...@@ -83,10 +83,9 @@ onMounted(async () => { ...@@ -83,10 +83,9 @@ onMounted(async () => {
await authInterceptor('/profile') await authInterceptor('/profile')
.then((response) => { .then((response) => {
profile.value = response.data profile.value = response.data
console.log(profile.value)
}) })
.catch((error) => { .catch((error) => {
return console.log(error) console.error(error)
}) })
}) })
...@@ -136,7 +135,7 @@ const saveChanges = async () => { ...@@ -136,7 +135,7 @@ const saveChanges = async () => {
<input <input
v-model="profile.firstName" v-model="profile.firstName"
:class="{ 'bg-green-200': isFirstNameValid }" :class="{ 'bg-green-200': isFirstNameValid }"
name="firstname" name="firstName"
placeholder="Skriv inn fornavn" placeholder="Skriv inn fornavn"
type="text" type="text"
/> />
...@@ -151,7 +150,7 @@ const saveChanges = async () => { ...@@ -151,7 +150,7 @@ const saveChanges = async () => {
<input <input
v-model="profile.lastName" v-model="profile.lastName"
:class="{ 'bg-green-200': isLastNameValid }" :class="{ 'bg-green-200': isLastNameValid }"
name="lastname" name="lastName"
placeholder="Skriv inn etternavn" placeholder="Skriv inn etternavn"
type="text" type="text"
/> />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment