feat(produser): added in the function to create a standard user based on there username

This commit is contained in:
2025-06-12 21:10:46 -05:00
parent 3283972809
commit 99ad79c662
13 changed files with 438 additions and 35 deletions

View File

@@ -0,0 +1,25 @@
import { queryOptions } from "@tanstack/react-query";
import axios from "axios";
export function getProdPerms(token: string) {
return queryOptions({
queryKey: ["prodPerms"],
queryFn: () => fetch(token),
enabled: !!token,
staleTime: 1000,
refetchOnWindowFocus: true,
});
}
const fetch = async (token: string) => {
const { data } = await axios.get("/api/produser/prodrole", {
headers: { Authorization: `Bearer ${token}` },
});
// if we are not localhost ignore the devDir setting.
// const url: string = window.location.host.split(":")[0];
// let settingsData = data.data;
// if (url != "localhost") {
// settingsData.filter((n: any) => n.name === "devDir");
// }
return data.data;
};

View File

@@ -1,23 +1,25 @@
import {queryOptions} from "@tanstack/react-query";
import { queryOptions } from "@tanstack/react-query";
import axios from "axios";
export function getSettings(token: string) {
return queryOptions({
queryKey: ["settings"],
queryFn: () => fetchSettings(token),
queryFn: () => fetch(token),
enabled: !!token,
staleTime: 1000,
refetchOnWindowFocus: true,
});
}
const fetchSettings = async (token: string) => {
const {data} = await axios.get("/api/server/settings", {headers: {Authorization: `Bearer ${token}`}});
const fetch = async (token: string) => {
const { data } = await axios.get("/api/server/settings", {
headers: { Authorization: `Bearer ${token}` },
});
// if we are not localhost ignore the devDir setting.
const url: string = window.location.host.split(":")[0];
let settingsData = data.data;
if (url != "localhost") {
settingsData.filter((n: any) => n.name === "devDir");
}
return settingsData;
// const url: string = window.location.host.split(":")[0];
// let settingsData = data.data;
// if (url != "localhost") {
// settingsData.filter((n: any) => n.name === "devDir");
// }
return data.data;
};