/
HttpMethods.vue
39 lines (33 loc) · 961 Bytes
/
HttpMethods.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script>
export default {
props: ['request'],
data () {
return {
methods: [
{name: "GET", color: "text-green-500"},
{name: "POST", color: "text-orange-400"},
{name: "DELETE", color: "text-red-600"},
{name: "PUT", color: "text-blue-500"},
{name: "PATCH", color: "text-blue-400"},
{name: "OPTIONS", color: "text-grey-500"}
]
}
},
computed: {
method() {
const selectedMethod = this.request.content.selectedMethod || this.request.info.methods[0]
return this.methods.filter(method => method.name === selectedMethod)[0]
}
}
}
</script>
<template>
<span :class="'w-full inline-block max-w-xxs text-xs font-bold uppercase ' + method.color">
{{ method.name }}
</span>
</template>
<style scoped>
.max-w-xxs {
max-width: 45px;
}
</style>