add: frontend update
This commit is contained in:
17
frontend/src/js/store.ts
Normal file
17
frontend/src/js/store.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { create } from 'zustand'
|
||||
|
||||
type NavbarStore = {
|
||||
navOpened: boolean,
|
||||
setOpenNav: (opened: boolean) => void,
|
||||
closeNav: () => void,
|
||||
openNav: () => void,
|
||||
toggleNav: () => void,
|
||||
}
|
||||
|
||||
export const useNavbarStore = create<NavbarStore>()((set) => ({
|
||||
navOpened: false,
|
||||
setOpenNav: (opened: boolean) => set({ navOpened: opened }),
|
||||
closeNav: () => set({ navOpened: false }),
|
||||
openNav: () => set({ navOpened: true }),
|
||||
toggleNav: () => set((state) => ({ navOpened: !state.navOpened })),
|
||||
}))
|
||||
@@ -101,14 +101,14 @@ export async function postapi(path:string,data:any,is_form:boolean=false):Promis
|
||||
});
|
||||
}
|
||||
|
||||
export function getmainpath(){
|
||||
export function getMainPath(){
|
||||
const paths = window.location.pathname.split("/")
|
||||
if (paths.length > 1) return paths[1]
|
||||
return ""
|
||||
}
|
||||
|
||||
export function getapiobject(){
|
||||
switch(getmainpath()){
|
||||
switch(getMainPath()){
|
||||
case "nfregex":
|
||||
return nfregex
|
||||
case "regexproxy":
|
||||
|
||||
Reference in New Issue
Block a user