/
wax_boy
/
semaphore_custom
Обзор
Документация
Войти
/
wax_boy
/
semaphore_custom
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
develop
web/src/components/IntegrationExtractorChildValueFormBase.js
58 строк
1 KB
Denis Gukov
chore: remove extra fields
25 май 2025, 11:19
Не верифицирован
25 май 2025, 11:19
6df5d12
Код
Авторство
О чём код?
import axios from 'axios'; import { getErrorMessage } from '@/lib/error'; export default { props: { // integrationId: [Number, String], }, methods: { /** * Saves or creates item via API. * @returns {Promise<null>} null if validation didn't pass or user data if user saved. */ async save() { this.formError = null; if (!this.$refs.form.validate()) { this.$emit('error', {}); return null; } this.formSaving = true; let item; try { await this.beforeSave(); item = (await axios({ method: this.isNew ? 'post' : 'put', url: this.isNew ? this.getItemsUrl() : this.getSingleItemUrl(), responseType: 'json', data: { ...this.item, integration_id: this.integrationId, }, ...(this.getRequestOptions()), })).data; await this.afterSave(item); this.$emit('save', { item: item || this.item, action: this.isNew ? 'new' : 'edit', }); } catch (err) { this.formError = getErrorMessage(err); this.$emit('error', { message: this.formError, }); } finally { this.formSaving = false; } return item || this.item; }, }, };