handle Import by upload vtt json and
handle login, token generation and check
This commit is contained in:
@@ -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}`)
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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 = "";
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user