commencer cleanup
This commit is contained in:
parent
04fd45a792
commit
5fd32ef333
2
.env.sample
Normal file
2
.env.sample
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
VITE_CONJUREOS_HOST=
|
||||||
|
VITE_CONJUREOS_MQTT=
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,3 +26,4 @@ coverage
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
|
.env
|
||||||
|
|||||||
@ -12,9 +12,13 @@ const isLoginIn = ref(false)
|
|||||||
const login = (form) => {
|
const login = (form) => {
|
||||||
const formData = new FormData(form)
|
const formData = new FormData(form)
|
||||||
isLoginIn.value = true
|
isLoginIn.value = true
|
||||||
|
|
||||||
|
const myHeaders = new Headers();
|
||||||
|
myHeaders.append("API-Version", 1);
|
||||||
fetch(apiHost + 'login', {
|
fetch(apiHost + 'login', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData,
|
||||||
|
headers: myHeaders
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
isLoginIn.value = false
|
isLoginIn.value = false
|
||||||
|
|||||||
@ -5,15 +5,19 @@ import {usePlayerAuthStore} from '@/stores/player-auth';
|
|||||||
import router from '@/router';
|
import router from '@/router';
|
||||||
|
|
||||||
const apiHost = import.meta.env.VITE_CONJUREOS_HOST
|
const apiHost = import.meta.env.VITE_CONJUREOS_HOST
|
||||||
|
|
||||||
const errorStore = useErrorStore()
|
const errorStore = useErrorStore()
|
||||||
|
|
||||||
const isLoginIn = ref(false)
|
const isLoginIn = ref(false)
|
||||||
const signup = (form) => {
|
const signup = (form) => {
|
||||||
const formData = new FormData(form);
|
const formData = new FormData(form);
|
||||||
isLoginIn.value = true
|
isLoginIn.value = true
|
||||||
|
const myHeaders = new Headers();
|
||||||
|
myHeaders.append("API-Version", 1);
|
||||||
fetch(apiHost + 'signup', {
|
fetch(apiHost + 'signup', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData,
|
body: formData,
|
||||||
|
headers: myHeaders
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.status !== 200)
|
if (response.status !== 200)
|
||||||
|
|||||||
@ -19,8 +19,11 @@ const game = ref(undefined)
|
|||||||
const isActivating = ref(false)
|
const isActivating = ref(false)
|
||||||
console.log(route, route.meta)
|
console.log(route, route.meta)
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
const myHeaders = new Headers();
|
||||||
|
myHeaders.append("API-Version", 1);
|
||||||
fetch(apiHost + 'games/' + gameId.value, {
|
fetch(apiHost + 'games/' + gameId.value, {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
headers: myHeaders
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
@ -40,6 +43,7 @@ function activate() {
|
|||||||
method: 'POST', headers: {
|
method: 'POST', headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${auth.value.token}`,
|
'Authorization': `Bearer ${auth.value.token}`,
|
||||||
|
'API-Version': 1,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -68,6 +72,7 @@ function deactivate() {
|
|||||||
method: 'POST', headers: {
|
method: 'POST', headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${auth.value.token}`,
|
'Authorization': `Bearer ${auth.value.token}`,
|
||||||
|
'API-Version': 1,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|||||||
@ -14,8 +14,11 @@ const gamelistStore = useGamelistStore()
|
|||||||
const {list: gamelist} = storeToRefs(gamelistStore)
|
const {list: gamelist} = storeToRefs(gamelistStore)
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
const myHeaders = new Headers();
|
||||||
|
myHeaders.append("API-Version", 1);
|
||||||
fetch(apiHost + 'games', {
|
fetch(apiHost + 'games', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
headers: myHeaders
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
|||||||
@ -16,12 +16,14 @@ export default {
|
|||||||
submitForm() {
|
submitForm() {
|
||||||
const form = this.$refs.uploadForm
|
const form = this.$refs.uploadForm
|
||||||
const formData = new FormData(form)
|
const formData = new FormData(form)
|
||||||
|
console.log("Upload")
|
||||||
|
|
||||||
fetch(apiHost + 'games', {
|
fetch(apiHost + 'games', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData,
|
body: formData,
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: authStr.getAuth()
|
Authorization: authStr.getAuth(),
|
||||||
|
'API-Version': 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then((response) => response.text())
|
.then((response) => response.text())
|
||||||
|
|||||||
@ -21,9 +21,12 @@ const submit = (form) => {
|
|||||||
const formData = new FormData(form)
|
const formData = new FormData(form)
|
||||||
formData.set('token', route.query.token.toString())
|
formData.set('token', route.query.token.toString())
|
||||||
isLoginIn.value = true
|
isLoginIn.value = true
|
||||||
|
const myHeaders = new Headers();
|
||||||
|
myHeaders.append("API-Version", 1);
|
||||||
fetch(apiHost + route.query.action, {
|
fetch(apiHost + route.query.action, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: formData
|
body: formData,
|
||||||
|
headers: myHeaders,
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
isLoginIn.value = false
|
isLoginIn.value = false
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user