mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 08:14:47 -07:00
refactor typescript wiring
This commit is contained in:
parent
cea9ae62d8
commit
c62c336a11
286 changed files with 2999 additions and 3053 deletions
|
|
@ -1,15 +1,15 @@
|
|||
import React from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
import { ServerSelectors } from 'store';
|
||||
import { RouteEnum } from 'types';
|
||||
import { useAppSelector } from 'store/store';
|
||||
import { AuthenticationService } from 'api';
|
||||
import { ServerSelectors } from '@app/store';
|
||||
import { App } from '@app/types';
|
||||
import { useAppSelector } from '@app/store';
|
||||
import { AuthenticationService } from '@app/api';
|
||||
|
||||
const AuthGuard = () => {
|
||||
const state = useAppSelector(s => ServerSelectors.getState(s));
|
||||
return !AuthenticationService.isConnected(state)
|
||||
? <Navigate to={RouteEnum.LOGIN} />
|
||||
? <Navigate to={App.RouteEnum.LOGIN} />
|
||||
: <div></div>;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
import React from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
import { ServerSelectors } from 'store';
|
||||
import { AuthenticationService } from 'api';
|
||||
import { RouteEnum } from 'types';
|
||||
import { useAppSelector } from 'store/store';
|
||||
import { ServerSelectors } from '@app/store';
|
||||
import { AuthenticationService } from '@app/api';
|
||||
import { App } from '@app/types';
|
||||
import { useAppSelector } from '@app/store';
|
||||
|
||||
const ModGuard = () => {
|
||||
const user = useAppSelector(state => ServerSelectors.getUser(state));
|
||||
return !AuthenticationService.isModerator(user)
|
||||
? <Navigate to={RouteEnum.SERVER} />
|
||||
? <Navigate to={App.RouteEnum.SERVER} />
|
||||
: <></>;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue