Instant Update fixed

This commit is contained in:
DomySh
2022-06-15 19:44:41 +02:00
parent 0f912ce1b9
commit 591b500a9a
14 changed files with 800 additions and 3464 deletions

View File

@@ -1,10 +1,12 @@
import { showNotification } from "@mantine/notifications";
import { ImCross } from "react-icons/im";
import { TiTick } from "react-icons/ti"
import { GeneralStats, Service, ServiceAddForm, ServerResponse, RegexFilter, notification_time, RegexAddForm, ServerStatusResponse, PasswordSend, ChangePassword } from "./models";
import { GeneralStats, Service, ServiceAddForm, ServerResponse, RegexFilter, RegexAddForm, ServerStatusResponse, PasswordSend, ChangePassword } from "./models";
var Buffer = require('buffer').Buffer
export const eventUpdateName = "update-info"
const custom_url = (!process.env.NODE_ENV || process.env.NODE_ENV === 'development')?"http://127.0.0.1:8080":""
export async function getapi(path:string):Promise<any>{
@@ -42,6 +44,10 @@ export async function postapi(path:string,data:any):Promise<any>{
});
}
export function fireUpdateRequest(){
window.dispatchEvent(new Event(eventUpdateName))
}
export async function getstatus(){
return await getapi(`status`) as ServerStatusResponse;
}
@@ -139,7 +145,7 @@ export function getHumanReadableRegex(regexB64:string){
export function errorNotify(title:string, description:string ){
showNotification({
autoClose: notification_time,
autoClose: 2000,
title: title,
message: description,
color: 'red',
@@ -149,7 +155,7 @@ export function errorNotify(title:string, description:string ){
export function okNotify(title:string, description:string ){
showNotification({
autoClose: notification_time,
autoClose: 2000,
title: title,
message: description,
color: 'teal',