This file contains hidden or 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
import Vue from 'vue'; | |
import Vuetify from 'vuetify/lib/framework'; | |
import VStepperIcon from '@/components/VStepperIcon.vue' | |
import VStepperStepIcon from '@/components/VStepperStepIcon.vue' | |
Vue.use(Vuetify, { | |
components: { | |
VStepperIcon, | |
VStepperStepIcon, | |
}, |
This file contains hidden or 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 { VStepper } from 'vuetify/lib'; | |
// stepper step types by component name, so the VStepperIcon | |
// is able to display different types of stepper steps | |
const STEPPER_STEP_COMPONENTS = ['v-stepper-step', 'v-stepper-step-icon'] | |
// comparing name to possible stepper step component names | |
const isStepperStepComponent = (componentList) => { | |
return (name) => componentList.includes(name) | |
} | |
// function to check if a string is in the allowed componentList |
This file contains hidden or 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) { |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
NewerOlder