feat: add popop with awfuls colors and backend api call
This commit is contained in:
@ -1,17 +1,20 @@
|
||||
import {ref} from "vue";
|
||||
enum errorType {Error, Warning}
|
||||
|
||||
function addNewError(errorMessage: string, timeout?: number, type?: errorType){
|
||||
enum color {Red, Yellow, Blue, green}
|
||||
|
||||
function addNewMessage(errorMessage: string, type?: color, timeout?: number){
|
||||
if (timeout == null){
|
||||
timeout = 5000;
|
||||
}
|
||||
if (type == null){
|
||||
type = Error;
|
||||
type = color.Red;
|
||||
}
|
||||
errorList.value.push({errorMessage: errorMessage, timeout: timeout, type: type})
|
||||
setTimeout(() => errorList.value.pop(errorMessage), 5000)
|
||||
|
||||
const data = {errorMessage: errorMessage, timeout: timeout, type: type, uid: Math.random()*100000};
|
||||
errorList.value.push(data)
|
||||
setTimeout(() => errorList.value.slice(0, 1), timeout)
|
||||
}
|
||||
|
||||
const errorList = ref([])
|
||||
|
||||
export {addNewError, errorList}
|
||||
export {addNewMessage, errorList, color}
|
Reference in New Issue
Block a user