Added default tool

This commit is contained in:
2023-06-13 14:37:30 +02:00
parent 5d8a816a3b
commit b9045a8013
2 changed files with 14 additions and 7 deletions

View File

@@ -1,9 +1,12 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'; import { onMounted, ref } from 'vue';
import XmlTool from './components/XmlTool.vue' import XmlTool from './components/XmlTool.vue'
const activeToolBox = ref('') const activeToolBox = ref('')
onMounted(() => {
activeToolBox.value = "xml";
});
</script> </script>
<template> <template>

View File

@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue'; import { onMounted, ref, watch } from 'vue';
const xml = ref(''); const xml = ref('');
const transform = ref(''); const transform = ref('');
@@ -10,17 +10,17 @@ const activeXmlTool = ref('')
async function submit() { async function submit() {
const url = document.location.protocol + "//" + document.location.hostname + "/java/" + activeXmlTool.value; const url = document.location.protocol + "//" + document.location.hostname + "/java/" + activeXmlTool.value;
var jsonData = JSON.stringify({ var requestBody = JSON.stringify({
"data": xml.value, "data": xml.value,
"process": transform.value, "process": transform.value,
"processor": "xalan", "processor": "xalan",
"version": "3.0" "version": "3.0"
}); });
var requestData = {
body: jsonData, var request = new Request(url, {
body: requestBody,
method: "POST" method: "POST"
}; });
var request = new Request(url, requestData);
var responseBody = await fetch(request).then(async response => { var responseBody = await fetch(request).then(async response => {
@@ -43,6 +43,10 @@ watch(activeXmlTool, (tool) => {
transform.value = ""; transform.value = "";
}) })
onMounted(() => {
activeXmlTool.value = "xpath";
});
</script> </script>
<template> <template>