feat(produser): added in the function to create a standard user based on there username
This commit is contained in:
25
frontend/src/utils/querys/prodUser/getProdPerms.tsx
Normal file
25
frontend/src/utils/querys/prodUser/getProdPerms.tsx
Normal 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;
|
||||
};
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user