Sha256: a5f1c6a445668dced4e4f627637fdd76ea5aa650888e0906b706a3464aa16c00
Contents?: true
Size: 1.12 KB
Versions: 36
Compression:
Stored size: 1.12 KB
Contents
import ServerRefreshController from './server-refresh-controller' import { FetchRequest } from '@rails/request.js' export default class extends ServerRefreshController { static values = { previousCriterionId: Number, } async criterion() { const isValid = await this.validateBlueprint() if (isValid) { this.state.addCriterion(this.previousCriterionIdValue) } this.refreshFromServer({includeErrors: !isValid}) } async group() { const isValid = await this.validateBlueprint() if (isValid) { this.state.addGroup() } this.refreshFromServer({includeErrors: !isValid}) } async validateBlueprint(blueprint) { const { state } = this const request = new FetchRequest( "GET", this.state.validateBlueprintUrlValue, { query: { "refine_filters_builder[filter_class]": this.state.filterName, "refine_filters_builder[blueprint_json]": JSON.stringify(this.state.blueprint), "refine_filters_builder[client_id]": this.state.clientIdValue } } ) const response = await request.perform() return response.ok } }
Version data entries
36 entries across 36 versions & 1 rubygems