This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
let i = noItems | |
while(i--) { | |
sumData += items[i].data1 | |
} | |
resolve(sumData) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const addSingle = (items, noItems) => { | |
return new Promise((resolve) => { | |
let sumData = 0 | |
$.each(items, (i, el) => { | |
sumData += el.data1 | |
}) | |
resolve(sumData) | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ vue create custom-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchAPI = async () => { | |
const response = await fetch('https://jsonplaceholder.typicode.com/todos/1') | |
return response | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// setting the params & defaulting it to null | |
const fetchAPI = async ({ url = null } = { url: null }) => { | |
if (url) { | |
// handling error cases with a try-catch | |
try { | |
const response = await fetch(url) | |
return response | |
} catch (err) { | |
console.error(err) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchAPI = async ({ url = null } = { url: null }) => { | |
if (url) { | |
try { | |
const response = await fetch(url) | |
// checking for errors shown in fetch | |
if (!response.ok) { | |
throw { | |
isError: true, | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchAPI = async ({ url = null } = { url: null }) => { | |
if (url) { | |
try { | |
const response = await fetch(url) | |
if (!response.ok) { | |
throw { | |
isError: true, | |
} | |
} | |
// updating the return value to more sensible one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// unification of return values - even more sensible! | |
const fetchAPI = async ({ url = null } = { url: null }) => { | |
if (url) { | |
try { | |
const response = await fetch(url) | |
if (!response.ok) { | |
throw { | |
isError: true, | |
data: [], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchAPI = async ({ url = null } = { url: null }) => { | |
if (url) { | |
try { | |
const response = await fetch(url) | |
if (!response.ok) { | |
throw { | |
isError: true, | |
data: [], | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import { VStepperStep } from 'vuetify/lib/components/VStepper'; | |
export default { | |
name: 'v-stepper-step-icon', | |
// eslint-disable-next-line | |
extends: VStepperStep, | |
methods: { | |
genStepContent() { | |
const children = []; | |
if (this.hasError) { |