adding in character detail stuff

This commit is contained in:
jmosrael@gmail.com
2024-05-12 16:00:34 -07:00
parent e2b261e989
commit 1a3f8c4b25
5 changed files with 59 additions and 15 deletions

View File

@@ -3,6 +3,7 @@ import { createRouter, createWebHashHistory } from 'vue-router'
import GameList from '../vues/GameList.vue'
import GameDetails from '../vues/GameDetails.vue'
import CharacterList from '../vues/CharacterList.vue'
import CharacterDetails from '../vues/CharacterDetails.vue'
const root = {
path: '/',
@@ -24,7 +25,12 @@ const characterListRoute = {
component: CharacterList
}
const routes = [root, gameListRoute, gameDetailsRoute, characterListRoute]
const characterDetailsRoute = {
path: '/characters/:characterId',
component: CharacterDetails
}
const routes = [root, gameListRoute, gameDetailsRoute, characterListRoute, characterDetailsRoute]
export default createRouter({
history: createWebHashHistory(),

View File

@@ -0,0 +1,35 @@
<template>
<v-container>
{{ character.characterName }}
{{ character.playerName }}
{{ character.role }}
{{ character.status }}
</v-container>
</template>
<style></style>
<script setup lang="ts">
import { onMounted, watch, ref } from 'vue'
import { useRoute } from 'vue-router'
import axios from 'axios'
const route = useRoute()
const characterId = ref(route.params.characterId)
const character = ref({})
async function loadCharacterDetails() {
const characterResponse = await axios.get(`/api/character/${characterId.value}`)
const gameDetails = await axios.post("/api/game", {
})
console.log(characterResponse)
character.value = characterResponse.data
}
onMounted(async () => {
loadCharacterDetails()
})
</script>

View File

@@ -46,7 +46,7 @@ import axios from 'axios'
let page = 0
let count = 10
const characters = ref({})
const pageCount = ref({})
const pageCount = ref(1)
async function loadData() {
const response = await axios.post('/api/character', {

View File

@@ -35,7 +35,7 @@ import axios from 'axios'
let page = 1
let count = 10
const games = ref({})
const pageCount = ref({})
const pageCount = ref(1)
async function loadData() {
const response = await axios.post('/api/game', {