-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Makes the header reactive, previously it would not update after you login into the website * Persist auth status between sessions * fix the failing test
- Loading branch information
Showing
10 changed files
with
74 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,31 @@ | ||
<template> | ||
<AWLHeader /> | ||
<div> | ||
<h1>Dashboard</h1> | ||
<p>TODO: Insert the user dashboard here</p> | ||
<p>Username: {{ auth.user?.displayName }}</p> | ||
<p v-if="user">Username: {{ user.email }}</p> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { useAuthStore } from '@/stores/auth' | ||
import AWLHeader from '@/components/Header.vue' | ||
import router from '@/router' | ||
// must be logged in to see this page | ||
export default { | ||
name: 'AWLDashboard', | ||
setup() { | ||
const auth = useAuthStore() | ||
if (!auth.isAuthenticated) { | ||
auth.logout() | ||
const {user, isAuthenticated, logout} = useAuthStore() | ||
if (!isAuthenticated) { | ||
logout() | ||
router.push({ name: 'Login' }) | ||
} | ||
return { auth } | ||
return { user} | ||
}, | ||
components: { | ||
AWLHeader | ||
} | ||
} | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
import { describe, it, expect } from 'vitest' | ||
import { createPinia } from 'pinia' // Import the createPinia function from the 'pinia' package | ||
|
||
|
||
import { mount } from '@vue/test-utils' | ||
import SignupForm from '../SignupForm.vue' | ||
|
||
describe('SignupForm', () => { | ||
it('renders properly', () => { | ||
const wrapper = mount(SignupForm, { props: { msg: 'Signup Vitest' } }) | ||
expect(wrapper.text()).toContain('Signup Vitest') | ||
const pinia = createPinia() // Create a Pinia instance | ||
const wrapper = mount(SignupForm, { | ||
props: { msg: 'Signup Vitest' }, | ||
global: { | ||
plugins: [pinia] // Use the Pinia instance as a plugin | ||
} | ||
}) | ||
expect(wrapper.text()).toContain('Sign Up') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters