Implemented most of logic behind REST Mock Services
Added dev.sh script to run r11-tools in dev-mode with hot-reload for frontend
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, type Ref } from 'vue';
|
||||
|
||||
interface historyRecord {
|
||||
clientUUID : String,
|
||||
dateTimeStamp: String,
|
||||
headers : Object,
|
||||
httpMethod: String,
|
||||
requestBody: String
|
||||
}
|
||||
|
||||
|
||||
const clientUUID = localStorage.getItem("clientUUID")
|
||||
const fetchLink = window.location.protocol + "//" + window.location.hostname + "/mock/api/event";
|
||||
const historyRecords : Ref<Array<historyRecord>> = ref([])
|
||||
fetch(fetchLink+"/"+clientUUID).then(response => response.json()).then(data => { historyRecords.value = data });
|
||||
|
||||
function parseTimeStamp(timestamp : String){
|
||||
return timestamp.substring(10,19).replace("T"," ");
|
||||
}
|
||||
|
||||
function showHeaders(headers:Object){
|
||||
|
||||
}
|
||||
|
||||
function showBody(body : String){
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<template>
|
||||
<table class="text-white h-28 w-5/12 text-center border-l-4 border-b-2">
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>HTTP Method</th>
|
||||
<th>HTTP Headers</th>
|
||||
<th>Request Body</th>
|
||||
</tr>
|
||||
<tr v-for="(item , index) in historyRecords" :key="index">
|
||||
<td> {{ parseTimeStamp(item.dateTimeStamp) }} </td>
|
||||
<td> {{ item.httpMethod }} </td>
|
||||
<td> <button @click="showHeaders(item.headers);">Show Headers</button> </td>
|
||||
<td> <button @click="showBody(item.requestBody)">Show Body</button> </td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</template>
|
||||
Reference in New Issue
Block a user