mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add vue-toastification for alerting
This commit is contained in:
1 parent
2d0fffc8f4
commit
d0e2a4125d
7 files changed
+58
-22
No files matched your search
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import { RouterLink, useRouter } from 'vue-router'
|
||||
import { useToast } from 'vue-toastification'
|
||||
import api from '../utils/api'
|
||||
|
||||
const emit = defineEmits(['onSubmit', 'onChange'])
|
||||
@@ -24,6 +25,7 @@ const username = ref('')
|
||||
const email = ref('')
|
||||
const password = ref('')
|
||||
const errorMessage = ref('')
|
||||
const toast = useToast()
|
||||
|
||||
const availableMethods = ref({})
|
||||
onMounted(async () => {
|
||||
@@ -39,11 +41,10 @@ const hasSocialLogins = computed(() => {
|
||||
})
|
||||
|
||||
const success = () => {
|
||||
router.push({ name: 'game' })
|
||||
router.push({ name: 'game', params: { questId: 'helloworld' } })
|
||||
}
|
||||
|
||||
const error = (err) => {
|
||||
console.error(err)
|
||||
errorMessage.value = err
|
||||
}
|
||||
|
||||
@@ -62,8 +63,8 @@ const handleSubmit = () => {
|
||||
error,
|
||||
})
|
||||
} catch (err) {
|
||||
toast.error('Something went wrong.')
|
||||
console.error(err)
|
||||
errorMessage.value = 'Something went wrong'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user