Repository: louislam/uptime-kuma
File: src/components/notifications/Webhook.vue (Vue)

Code before:
<template>
    <div class="mb-3">
        <label for="webhook-url" class="form-label">{{ $t("Post URL") }}</label>
        <input
            id="webhook-url"
            v-model="$parent.notification.webhookURL"
            type="url"
            pattern="https?://.+"
            class="form-control"
            required
        />
    </div>

    <div class="mb-3">
        <label for="webhook-http-method" class="form-label">{{ $t("HTTP Method") }}</label>
        <select
            id="webhook-http-method"
            v-model="$parent.notification.httpMethod"
            class="form-select"
        >
            <option value="post">POST</option>
            <option value="get">GET</option>
        </select>
        <div class="form-text">
            {{ httpMethodDescription }}
        </div>
    </div>

    <div v-if="httpMethod !== 'get'" class="mb-3">
        <label for="webhook-request-body" class="form-label">{{ $t("Request Body") }}</label>
        <select
            id="webhook-request-body"
            v-model="$parent.notification.webhookContentType"
            class="form-select"
            required
        >
            <option value="json">{{ $t("webhookBodyPresetOption", ["application/json"]) }}</option>
            <option value="form-data">{{ $t("webhookBodyPresetOption", ["multipart/form-data"]) }}</option>
            <option value="custom">{{ $t("webhookBodyCustomOption") }}</option>
        </select>

        <div v-if="$parent.notification.webhookContentType == 'json'" class="form-text">{{ $t("webhookJsonDesc", ['"application/json"']) }}</div>
        <i18n-t v-else-if="$parent.notification.webhookContentType == 'form-data'" tag="div" keypath="webhookFormDataDesc" class="form-text">
            <template #multipart>multipart/form-data"</template>
            <template #decodeFunction>
                <strong>json_decode($_POST['data'])</strong>
            </template>
        </i18n-t>
        <template v-else-if="$parent.notification.webhookContentType == 'custom'">
            <TemplatedTextarea id="customBody" v-model="$parent.notification.webhookCustomBody" :required="true" :placeholder="customBodyPlaceholder"></TemplatedTextarea>

Review comment (suggestion):
much simpler to read this way

```suggestion
            {{ $parent.notification.httpMethod === 'get' ? $t("webhookGetMethodDesc") : $t("webhookPostMethodDesc") }}
```

Code after:
<template>
    <div class="mb-3">
        <label for="webhook-url" class="form-label">{{ $t("Post URL") }}</label>
        <input
            id="webhook-url"
            v-model="$parent.notification.webhookURL"
            type="url"
            pattern="https?://.+"
            class="form-control"
            required
        />
    </div>

    <div class="mb-3">
        <label for="webhook-http-method" class="form-label">{{ $t("HTTP Method") }}</label>
        <select
            id="webhook-http-method"
            v-model="$parent.notification.httpMethod"
            class="form-select"
        >
            <option value="post">POST</option>
            <option value="get">GET</option>
        </select>
        <div class="form-text">
            {{ $parent.notification.httpMethod === 'get' ? $t("webhookGetMethodDesc") : $t("webhookPostMethodDesc") }}
        </div>
    </div>

    <div v-if="$parent.notification.httpMethod === 'post'" class="mb-3">
        <label for="webhook-request-body" class="form-label">{{ $t("Request Body") }}</label>
        <select
            id="webhook-request-body"
            v-model="$parent.notification.webhookContentType"
            class="form-select"
            required
        >
            <option value="json">{{ $t("webhookBodyPresetOption", ["application/json"]) }}</option>
            <option value="form-data">{{ $t("webhookBodyPresetOption", ["multipart/form-data"]) }}</option>
            <option value="custom">{{ $t("webhookBodyCustomOption") }}</option>
        </select>

        <div v-if="$parent.notification.webhookContentType == 'json'" class="form-text">{{ $t("webhookJsonDesc", ['"application/json"']) }}</div>
        <i18n-t v-else-if="$parent.notification.webhookContentType == 'form-data'" tag="div" keypath="webhookFormDataDesc" class="form-text">
            <template #multipart>multipart/form-data"</template>
            <template #decodeFunction>
                <strong>json_decode($_POST['data'])</strong>
            </template>
        </i18n-t>
        <template v-else-if="$parent.notification.webhookContentType == 'custom'">
            <TemplatedTextarea id="customBody" v-model="$parent.notification.webhookCustomBody" :required="true" :placeholder="customBodyPlaceholder"></TemplatedTextarea>