Implemeted error signal in HTML and JSON formatter
This commit is contained in:
@@ -1,8 +1,18 @@
|
||||
<script setup lang="ts">
|
||||
const props = defineProps(
|
||||
{
|
||||
formatType: {type:String,required:true},
|
||||
code: {type:String,required:true},
|
||||
formatType: {
|
||||
type:String,
|
||||
required:true
|
||||
},
|
||||
code: {
|
||||
type:String,
|
||||
required:true
|
||||
},
|
||||
isError: {
|
||||
type:Boolean,
|
||||
required:false
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -24,7 +34,7 @@ function getTypeInfo(){
|
||||
function createBody(){
|
||||
return JSON.stringify({
|
||||
"data": props.code,
|
||||
"process": getTypeInfo(),
|
||||
"processorData": getTypeInfo(),
|
||||
"processor": "libxml",
|
||||
"version": "1.0"
|
||||
});
|
||||
@@ -33,11 +43,13 @@ function createBody(){
|
||||
const fetchLink = document.location.protocol + "//" + document.location.hostname + "/libxml/html/" + chooseType(props.formatType);
|
||||
|
||||
const emit = defineEmits([
|
||||
'update:result'
|
||||
'update:result',
|
||||
'update:error'
|
||||
])
|
||||
|
||||
function processResponse(formattedCode : any){
|
||||
var result = formattedCode.result;
|
||||
emit("update:error", formattedCode.status == "ERR")
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user