upgrade packages + improve typing

This commit is contained in:
seavor 2026-04-14 11:34:29 -05:00
parent fd55f4fb7f
commit 19f5eefdd2
138 changed files with 4504 additions and 11015 deletions

View file

@ -1,24 +1,16 @@
import React from 'react';
import { connect } from 'react-redux';
import { Navigate } from 'react-router-dom';
import { ServerSelectors } from 'store';
import { RouteEnum } from 'types';
import { useAppSelector } from 'store/store';
import { AuthenticationService } from 'api';
const AuthGuard = ({ state }: AuthGuardProps) => {
const AuthGuard = () => {
const state = useAppSelector(s => ServerSelectors.getState(s));
return !AuthenticationService.isConnected(state)
? <Navigate to={RouteEnum.LOGIN} />
: <div></div>;
};
interface AuthGuardProps {
state: number;
}
const mapStateToProps = state => ({
state: ServerSelectors.getState(state),
});
export default connect(mapStateToProps)(AuthGuard);
export default AuthGuard;

View file

@ -1,27 +1,16 @@
import React, { Component } from 'react';
import { connect } from 'react-redux';
import React from 'react';
import { Navigate } from 'react-router-dom';
import { ServerSelectors } from 'store';
import { User } from 'types';
import { AuthenticationService } from 'api';
import { RouteEnum } from 'types';
import { useAppSelector } from 'store/store';
class ModGuard extends Component<ModGuardProps> {
render() {
return !AuthenticationService.isModerator(this.props.user)
? <Navigate to={RouteEnum.SERVER} />
: '';
}
const ModGuard = () => {
const user = useAppSelector(state => ServerSelectors.getUser(state));
return !AuthenticationService.isModerator(user)
? <Navigate to={RouteEnum.SERVER} />
: <></>;
};
interface ModGuardProps {
user: User;
}
const mapStateToProps = state => ({
user: ServerSelectors.getUser(state),
});
export default connect(mapStateToProps)(ModGuard);
export default ModGuard;