Redirect to /login on '+ create market' click
This commit is contained in:
parent
0827451f5e
commit
c691473d3c
|
@ -13,7 +13,11 @@
|
||||||
<script setup>
|
<script setup>
|
||||||
import MarketForm from './MarketForm'
|
import MarketForm from './MarketForm'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
|
import { useSession } from '@/stores/session'
|
||||||
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
|
const session = useSession()
|
||||||
|
const router = useRouter()
|
||||||
const markets = ref([])
|
const markets = ref([])
|
||||||
const showForm = ref(false)
|
const showForm = ref(false)
|
||||||
|
|
||||||
|
@ -25,6 +29,9 @@ await fetch(url).then(async r => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const toggleForm = () => {
|
const toggleForm = () => {
|
||||||
|
if (!session.isAuthenticated) {
|
||||||
|
return router.push('/login')
|
||||||
|
}
|
||||||
showForm.value = !showForm.value
|
showForm.value = !showForm.value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue