reverted back from vue typescript to javascript to fix bad performance...
This commit is contained in:
@@ -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."
|
||||
|
||||
Reference in New Issue
Block a user