reverted back from vue typescript to javascript to fix bad performance...

This commit is contained in:
Sockenklaus
2023-07-10 23:05:49 +02:00
parent 7f33499459
commit 3534b9fb8d
16 changed files with 593 additions and 346 deletions

View File

@@ -1,6 +1,6 @@
<template>
</template>
<script setup lang="ts">
<script setup>
import { useMessage } from 'naive-ui'
import { onUpdated, onMounted } from 'vue'
@@ -15,13 +15,13 @@
displayNewMessages(props.messages)
})
function displayNewMessages(messages: any) {
function displayNewMessages(messages) {
let output: Array<Object> = []
let output = []
output = flattenObject(removeValidationErrors(messages))
output?.forEach((item: any) => {
output?.forEach((item) => {
for (let key in item) {
switch (key){
case 'error':
@@ -52,24 +52,24 @@
})
}
function removeValidationErrors(input: any) {
function removeValidationErrors(input) {
if(input === null || !input.hasOwnProperty("errors")) return input
const { errors: _, ...output } = (input as any)
const { errors: _, ...output } = (input)
return output
}
function flattenObject(input: Object) {
function flattenObject(input) {
if (input === null) return input
return Object.values(input).map((value: any) => Object.entries(value)).flat().reduce((acc: Array<Object>, [key, value]) => {
return Object.values(input).map((value) => Object.entries(value)).flat().reduce((acc, [key, value]) => {
acc.push({[key]: value});
return acc;
}, []);
}
function translateError(errorMsg: string) {
function translateError(errorMsg) {
switch(errorMsg.split(":")[0]) {
case 'E_INVALID_AUTH_PASSWORD':
return "Falsches Passwort eingegeben."

View File

@@ -9,14 +9,10 @@
</div>
</template>
<script lang="ts" setup>
import type { Ref, Component } from 'vue'
import type { MenuOption } from 'naive-ui'
import type { User } from '../types/User'
<script setup>
import { NIcon } from 'naive-ui'
import { Link, usePage } from '@inertiajs/vue3'
import { h, ref } from 'vue';
import { NIcon, NMenu } from 'naive-ui'
import {
GroupsFilled as Users,
EventNoteFilled as Events,
@@ -25,10 +21,10 @@
PersonRound as Profile,
} from '@vicons/material'
const activeKey: Ref<string> = ref((usePage().props.request as any)?.url)
const user: User = usePage().props.user as User
const activeKey= ref(usePage().props.request?.url)
const user = usePage().props.user
const menuOptions: MenuOption[] = []
const menuOptions = []
menuOptions.push({
label: () =>
@@ -89,7 +85,7 @@
function renderIcon(icon: Component) {
function renderIcon(icon) {
return () => h(NIcon, null, { default: () => h(icon) })
}