DEMOUSER Toast

This commit is contained in:
2024-10-14 19:57:36 +02:00
parent 09fd5f3032
commit dafefb83f2

View File

@@ -7,11 +7,13 @@ import { SettingsContext } from './SettingsProvider';
import { ThemeButton, ThemeText } from './common/ThemeTypes';
import { useColors } from './common/colors';
import Login from './screens/Login';
import { ToastType, useToast } from './common/ToastProvider';
export const InterfaceContext = createContext<any>(null);
const Interface = ({ children }) => {
const colors = useColors();
const { showToast, hideToast } = useToast();
const { settings } = useContext(SettingsContext);
const [userInformation, setUserInformation] = useState(null);
const [baseData, setBaseData] = useState(null);
@@ -76,6 +78,8 @@ const Interface = ({ children }) => {
const fetchUserInformation = async (username) => {
const userinformation = await requestGet(`userinformation/?username=${username}`, false);
if (!userinformation) {
console.log("Using Demoinformation");
showToast(ToastType.Info, "You are using a DEMOUSER", 5000);
return await requestGet(`demoinformation/`);
}
return userinformation;
@@ -202,4 +206,4 @@ export class NetworkError extends Error {
this.name = "NetworkError";
this.url = url;
}
}
}