Redirect to /login on '+ create market' click

This commit is contained in:
ekzyis 2023-11-20 20:36:55 +01:00
parent 0827451f5e
commit c691473d3c
1 changed files with 7 additions and 0 deletions

View File

@ -13,7 +13,11 @@
<script setup>
import MarketForm from './MarketForm'
import { ref } from 'vue'
import { useSession } from '@/stores/session'
import { useRouter } from 'vue-router'
const session = useSession()
const router = useRouter()
const markets = ref([])
const showForm = ref(false)
@ -25,6 +29,9 @@ await fetch(url).then(async r => {
})
const toggleForm = () => {
if (!session.isAuthenticated) {
return router.push('/login')
}
showForm.value = !showForm.value
}