Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let itemName = evt.topic.split('/')[2]
let item = context.getters.name(itemName)
if (item.transformedState) {
// need to get the transformedState from the API
axios.get('/rest/items/' + itemName).then((resp) => {
context.commit('updateOne', { itemName: itemName, newState: payload.value, newTransformedState: resp.data.transformedState })
})
} else {
context.commit('updateOne', { itemName: itemName, newState: payload.value })
}
}
if (evt.type.indexOf('ItemAddedEvent') >= 0 || evt.type.indexOf('ItemUpdatedEvent') >= 0 || evt.type.indexOf('ItemRemovedEvent') >= 0) {
console.log('Items have changed, refreshing store')
eventSource.close() // close the event source immediately to avoid catching more events
Notify.create({ type: 'info', message: 'Items have changed, refreshing' })
setTimeout(() => {
context.dispatch('initialLoad').then(() => {
context.dispatch('watchEvents')
})
}, 500)
}
}
creationHandler () {
var TTT = this
globalStore.commit('SET_APIFN', TTT.$callDockjobAPI)
if (globalStore.getters.datastoreState === 'INITIAL') {
Loading.show()
var callback = {
ok: function (response) {
Loading.hide()
if (globalStore.getters.datastoreState === 'INITIAL') {
console.log('Error state STILL initial - stopping infinite loop')
} else {
// TTT.$router.replace(TTT.$route.query.redirect || '/')
TTT.creationHandler()
}
},
error: function (response) {
Loading.hide()
console.log('Error frontend connection data state: ' + response.message)
Notify.create(response.message)
}
}
};
const {
// @ts-ignore
data: {
listBookings: { items: bookingData }
}
} = await API.graphql(graphqlOperation(listBookings, bookingFilter));
let bookings = bookingData.map(booking => new Booking(booking));
console.log(bookings);
commit("SET_BOOKINGS", bookings);
resolve();
Loading.hide();
} catch (err) {
console.error(err);
reject(err);
}
});
}
ok: function (response) {
// console.log(response.data.guid)
Loading.hide()
TTT.pinnedJobs = response.data.result
TTT.loading = false
if (!response.data.dePaginatorResp.complete) {
Notify.create({color: 'info', message: 'Not all pinned jobs were queried back'})
}
},
error: function (error) {
ok: function (response) {
// console.log(response.data.name)
TTT.selectedSecond = []
TTT.request({
pagination: TTT.jobsDataTableSettings.serverPagination,
filter: TTT.jobsDataTableSettings.filter
})
Notify.create({color: 'positive', detail: 'Job "' + response.data.name + '" Deleted'})
},
error: function (error) {
creationHandler () {
var TTT = this
if (globalStore.getters.datastoreState === 'INITIAL') {
Loading.show()
var callback = {
ok: function (response) {
Loading.hide()
if (globalStore.getters.datastoreState === 'INITIAL') {
console.log('Error state STILL initial - stopping infinite loop')
}
else {
// TTT.$router.replace(TTT.$route.query.redirect || '/')
TTT.creationHandler()
}
},
error: function (response) {
Loading.hide()
console.log('Error frontend connection data state: ' + response.message)
Toast.create(response.message)
}
async function processBooking({ chargeToken, outboundFlight }) {
const processBookingInput = {
input: {
paymentToken: chargeToken,
bookingOutboundFlightId: outboundFlight.id
}
};
try {
Loading.show({
message: "Creating a new booking..."
});
const {
// @ts-ignore
data: {
processBooking: { id: bookingProcessId }
}
} = await API.graphql(
graphqlOperation(processBookingMutation, processBookingInput)
);
return bookingProcessId;
} catch (err) {
console.error(err);
throw err;
ok: function (response) {
Loading.hide()
if (globalStore.getters.datastoreState === 'INITIAL') {
console.log('Error state STILL initial - stopping infinite loop')
} else {
// TTT.$router.replace(TTT.$route.query.redirect || '/')
TTT.creationHandler()
}
},
error: function (response) {
updateStats: debounce(state => {
state.content = convertHtmlToTxt(state.contentHTML)
state.sentences = state.content
.replace(/(\.+|:|;|\?|!)/g, '$1\n')
.split(/\n+\s*/)
.filter(n => n)
state.words = state.content.split(/\s+/).filter(n => n)
if (state.words) {
LocalStorage.set(CONTENT_BACKUP_KEY, state.contentHTML)
} else {
LocalStorage.remove(CONTENT_BACKUP_KEY)
}
}, 100 /* Execute at most once every 100ms */)
},
updateContentAndStats () {
this.content = this.convertHtmlToTxt(this.contentHTML)
// Store backup content (only if there is valid text)
if (this.content && this.content.length > 0) {
LocalStorage.set(CONTENT_BACKUP_KEY, this.contentHTML)
}
else {
LocalStorage.remove(CONTENT_BACKUP_KEY)
}
this.sentences = this.content
.replace(/(\.+|:|;|\?|!)/g, '$1\n')
.split(/\n+\s*/)
.filter(n => n)
this.words = this.content
.split(/\s+/)
.filter(n => n)
},
processEditOperation (operation) {