Skip to content

Instantly share code, notes, and snippets.

View gegeke's full-sized avatar
🎯
Focusing

Gergely Muka gegeke

🎯
Focusing
  • Tricentis
  • Vienna
View GitHub Profile
@gegeke
gegeke / vuetify.js
Created October 14, 2021 13:02
VStepperIcon plugins/vuetify.js
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,
},
@gegeke
gegeke / VStepperIcon.vue
Created October 14, 2021 12:58
VStepperIcon
<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
@gegeke
gegeke / VStepperStepIcon.vue
Created October 14, 2021 12:56
VStepperStepIcon
<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) {
@gegeke
gegeke / apiHub_06.js
Created April 20, 2021 18:45
Creating an API HUB 06
const fetchAPI = async ({ url = null } = { url: null }) => {
if (url) {
try {
const response = await fetch(url)
if (!response.ok) {
throw {
isError: true,
data: [],
}
}
@gegeke
gegeke / apiHub_05.js
Created April 20, 2021 18:44
Creating an API HUB 05
// 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: [],
}
@gegeke
gegeke / apiHub_04.js
Created April 20, 2021 18:43
Creating an API HUB 04
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
@gegeke
gegeke / apiHub_03.js
Created April 20, 2021 18:42
Creating an API HUB 03
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,
}
}
@gegeke
gegeke / apiHub_02.js
Created April 20, 2021 18:41
Creating an API HUB 02
// 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)
}
@gegeke
gegeke / apiHub_01.js
Created April 20, 2021 18:39
Creating an API HUB 01
const fetchAPI = async () => {
const response = await fetch('https://jsonplaceholder.typicode.com/todos/1')
return response
}
$ vue create custom-plugin