evepraisal id

This commit is contained in:
2023-07-26 11:06:01 +02:00
parent 8c4d532788
commit 18dc329932
3 changed files with 34 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import { evepraisalAxiosInstance } from '@/service';
import { useVModel } from '@vueuse/core';
interface Props {
@@ -16,11 +17,28 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits<Emits>();
const value = useVModel(props, 'modelValue', emit);
const loadFromId = async (e: Event) => {
const input = e.target as HTMLInputElement;
const id = input.value;
if (!id) {
return;
}
const response = await evepraisalAxiosInstance.get(`/a/${id}.json`);
if (response.status !== 200) {
return;
}
value.value = JSON.stringify(response.data);
input.value = '';
}
</script>
<template>
<div class="flex-1 mx-1">
<span>{{ name }}</span>
<textarea class="w-full border rounded" v-model="value" />
<span>{{ name }}</span><input type="text" class="border rounded ms-2 px-1" @change="loadFromId" placeholder="id evepraisal" />
<textarea class="w-full border rounded mt-1" v-model="value" />
</div>
</template>

View File

@@ -6,4 +6,12 @@ export const apiAxiosInstance = axios.create({
'accept': 'application/json',
"Content-Type": "application/json"
},
})
export const evepraisalAxiosInstance = axios.create({
baseURL: '/appraisal/',
headers: {
'accept': 'application/json',
"Content-Type": "application/json"
},
})

View File

@@ -20,6 +20,12 @@ export default defineConfig({
changeOrigin: true,
followRedirects: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
'/appraisal/': {
target: 'https://evepraisal.shendai.rip/',
changeOrigin: true,
followRedirects: true,
rewrite: (path) => path.replace(/^\/appraisal/, ''),
}
}
},