commencer cleanup

This commit is contained in:
Trit0 2025-02-13 15:20:40 -05:00
parent 04fd45a792
commit 5fd32ef333
8 changed files with 27 additions and 3 deletions

2
.env.sample Normal file
View File

@ -0,0 +1,2 @@
VITE_CONJUREOS_HOST=
VITE_CONJUREOS_MQTT=

1
.gitignore vendored
View File

@ -26,3 +26,4 @@ coverage
*.njsproj
*.sln
*.sw?
.env

View File

@ -12,9 +12,13 @@ const isLoginIn = ref(false)
const login = (form) => {
const formData = new FormData(form)
isLoginIn.value = true
const myHeaders = new Headers();
myHeaders.append("API-Version", 1);
fetch(apiHost + 'login', {
method: 'POST',
body: formData
body: formData,
headers: myHeaders
})
.then((response) => {
isLoginIn.value = false

View File

@ -5,15 +5,19 @@ import {usePlayerAuthStore} from '@/stores/player-auth';
import router from '@/router';
const apiHost = import.meta.env.VITE_CONJUREOS_HOST
const errorStore = useErrorStore()
const isLoginIn = ref(false)
const signup = (form) => {
const formData = new FormData(form);
isLoginIn.value = true
const myHeaders = new Headers();
myHeaders.append("API-Version", 1);
fetch(apiHost + 'signup', {
method: 'POST',
body: formData,
headers: myHeaders
})
.then((response) => {
if (response.status !== 200)

View File

@ -19,8 +19,11 @@ const game = ref(undefined)
const isActivating = ref(false)
console.log(route, route.meta)
onMounted(() => {
const myHeaders = new Headers();
myHeaders.append("API-Version", 1);
fetch(apiHost + 'games/' + gameId.value, {
method: 'GET',
headers: myHeaders
})
.then((response) => response.json())
.then((result) => {
@ -40,6 +43,7 @@ function activate() {
method: 'POST', headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${auth.value.token}`,
'API-Version': 1,
},
})
.then((response) => {
@ -68,6 +72,7 @@ function deactivate() {
method: 'POST', headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${auth.value.token}`,
'API-Version': 1,
},
})
.then((response) => {

View File

@ -14,8 +14,11 @@ const gamelistStore = useGamelistStore()
const {list: gamelist} = storeToRefs(gamelistStore)
onMounted(() => {
const myHeaders = new Headers();
myHeaders.append("API-Version", 1);
fetch(apiHost + 'games', {
method: 'GET',
headers: myHeaders
})
.then((response) => response.json())
.then((result) => {

View File

@ -16,12 +16,14 @@ export default {
submitForm() {
const form = this.$refs.uploadForm
const formData = new FormData(form)
console.log("Upload")
fetch(apiHost + 'games', {
method: 'POST',
body: formData,
headers: {
Authorization: authStr.getAuth()
Authorization: authStr.getAuth(),
'API-Version': 1
}
})
.then((response) => response.text())

View File

@ -21,9 +21,12 @@ const submit = (form) => {
const formData = new FormData(form)
formData.set('token', route.query.token.toString())
isLoginIn.value = true
const myHeaders = new Headers();
myHeaders.append("API-Version", 1);
fetch(apiHost + route.query.action, {
method: 'POST',
body: formData
body: formData,
headers: myHeaders,
})
.then((response) => {
isLoginIn.value = false