handle Import by upload vtt json and

handle login, token generation and check
This commit is contained in:
2025-01-04 21:29:33 +01:00
parent 0a5971cea4
commit e32102509c
12 changed files with 594 additions and 104 deletions
+3 -3
View File
@@ -3,7 +3,7 @@
<h2>Your Characters</h2>
<ul>
<li v-for="character in characters" :key="character.character_id">
{{ character.name }} ({{ character.rasse }})
{{ character.name }} ({{ character.rasse }}, {{ character.typ }}, {{ character.grad }}, {{ character.owner }}, {{ character.public }} )
<button @click="goToAusruestung(character.character_id)">Manage Equipment</button>
</li>
</ul>
@@ -21,14 +21,14 @@ export default {
},
async created() {
const token = localStorage.getItem('token')
const response = await API.get('/characters', {
const response = await API.get('/api/characters', {
headers: { Authorization: `Bearer ${token}` },
})
this.characters = response.data
},
methods: {
goToAusruestung(characterId) {
this.$router.push(`/ausruestung/${characterId}`)
this.$router.push(`/api/ausruestung/${characterId}`)
},
},
}
+1 -1
View File
@@ -29,7 +29,7 @@ export default {
const response = await API.post("/register", {
username: this.username,
email: this.email,
passwordhash: this.password,
password: this.password,
});
this.success = "Registration successful! You can now log in.";
this.error = "";
+2 -2
View File
@@ -7,7 +7,7 @@
<input type="file" id="file_vtt" @change="onFileChange($event, 1)" />
</div>
<div>
<label for="file_csv">Char CSS (optional):</label>
<label for="file_csv">Char CSV (optional):</label>
<input type="file" id="file_csv" @change="onFileChange($event, 2)" />
</div>
<button type="submit" :disabled="!file_vtt">Upload</button>
@@ -59,7 +59,7 @@ export default {
if (this.file_csv) formData.append("file_csv", this.file_csv);
const token = localStorage.getItem("token"); // Get token from storage
const response = await API.post("/upload", formData, {
const response = await API.post("/api/upload", formData, {
headers: {
"Content-Type": "multipart/form-data",
"Authorization": `Bearer ${token}`, // Include token in the header