1

Такая проблема, при клике на кнопку должен передаваться параметр value на сервер но при отправки в ответ присылает "response":false,"errors":"The value field is required."" Вот код:

<td class="flex">
    <input type="text" name="text" v-model="name" class="form-control finance-width">
    <button class="button-add mini-button form-control" v-on:click="addIncomes()">Add</button>
</td>
data() {
        return {
            name: '',
            getIncomes: [],
            outcome: {},
            purchase: {}
        }
    },

async addIncomes() {
            let fd = new FormData();
            fd.append('name', this.name);

            const responseIncomes = await fetch('https://lys.open-k.com/realty/income?realty_id=' + this.$parent.realtyId, {
                method: "POST",
                body: fd
            })
            if (responseIncomes.status !== 200) {
                console.error('Income | error')
            }

            const incomeResponse = await responseIncomes.json()
            this.getIncomes.push(incomeResponse)

            this.name = ''
        },

1 ответ 1

2

Разве вы не передаёте name вместо value?

The value field is required

говорит о том, что бэк ждёт обязательный проп value.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.