Commit 01c229d1 authored by Bart Delrue's avatar Bart Delrue

Added basic mock for a domainChecker.

parent 589d142b
......@@ -17,19 +17,27 @@ class Service {
}
async get (id, params) {
const re = new RegExp(/^((?:(?:(?:[A-Za-z0-9][-]?)*)\w)+)((?:(?:(?:\w[\-]?){1,62})\w)+)\.(\w{2,6})$/) //eslint-disable-line
const valid = id.match(re) !== null
const states = ['available', 'not_available', 'unknown']
return {
id, text: `A new message with ID: ${id}!`
domain: id,
valid: valid,
state: valid ? states[Math.floor(Math.random() * states.length)] : valid
}
}
async create (data, params) {
setTimeout(() => {
axios.post(data.callbackUrl, { domain: data.domain }, axiosConfig).then(() => {
console.log('done')
}).catch((err) => {
console.log(err)
console.log(data)
})
axios.post(data.callbackUrl, {domain: data.domain}, axiosConfig)
.then(() => {
console.log('done')
})
.catch((err) => {
console.log(err)
console.log(data)
})
}, data.delay)
return data
......@@ -44,7 +52,7 @@ class Service {
}
async remove (id, params) {
return { id }
return {id}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment