Skip to content

Commit

Permalink
redirect user after sign in and sign up
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhaerter committed Sep 26, 2023
1 parent ec05839 commit a8902ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/views/LoginView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
import { ref } from 'vue';
import { useMutation } from '@urql/vue';
import { graphql } from '@/gql';
import { useRouter } from 'vue-router';
const router = useRouter()
const email = ref('')
const password = ref('')
Expand Down Expand Up @@ -55,5 +58,6 @@ async function onSubmit() {
}
localStorage.setItem('token', data?.signIn.token)
console.log(data)
await router.push('/')
}
</script>
4 changes: 4 additions & 0 deletions frontend/src/views/SignUpView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ import { ref } from 'vue'
import { useMutation } from '@urql/vue'
import { graphql } from '@/gql'
import useToken from '@/composables/useUser'
import { useRouter } from 'vue-router';
const router = useRouter()
const name = ref('')
const email = ref('')
Expand Down Expand Up @@ -64,5 +67,6 @@ async function onSubmit() {
localStorage.setItem('token', data?.signUp.token)
console.log(data)
await router.push('/')
}
</script>

0 comments on commit a8902ff

Please sign in to comment.