Migrate some leftover vue 2 legacy code

This commit is contained in:
Ramon Wenger 2023-02-09 16:03:12 +01:00
parent 3b1d0dc256
commit b910f5216a
3 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ const resizeElement = (el: HTMLElement) => {
export default {
update: resizeElement,
inserted: resizeElement,
mounted: resizeElement,
created(el: HTMLElement) {
el.classList.add('skillbox-auto-grow');
el.addEventListener('input', () => {

View File

@ -1,12 +1,12 @@
const getRidOfEdges = (collection) => {
const getRidOfEdges = (collection: any) => {
// todo: get rid of this, this probably doesn't work too well with immutable objects
// todo: don't use edges if they're not necessary
if (typeof collection === 'object' && collection && !Array.isArray(collection)) {
let newObj = {};
const newObj: Record<string, any> = {};
for (const k in collection) {
if (Object.prototype.hasOwnProperty.call(collection, k)) {
if (k === 'edges') {
return collection.edges.map((edge) => getRidOfEdges(edge.node));
return collection.edges.map((edge: any) => getRidOfEdges(edge.node));
} else {
newObj[k] = getRidOfEdges(collection[k]);
if (newObj[k]) {
@ -22,8 +22,8 @@ const getRidOfEdges = (collection) => {
};
const EdgesPlugin = {
install(Vue) {
Vue.prototype.$getRidOfEdges = getRidOfEdges;
install(app: any) {
app.config.globalProperties.$getRidOfEdges = getRidOfEdges;
},
};

View File

@ -1,7 +1,7 @@
import flavorValues from '@/helpers/app-flavor';
export default {
install: (Vue) => {
Vue.prototype.$flavor = Object.assign({}, flavorValues);
install: (app) => {
app.config.globalProperties.$flavor = Object.assign({}, flavorValues);
},
};