mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-10 15:14:33 +08:00
extracts route magic strings to routes constants
This commit is contained in:
parent
5733d79943
commit
4ea4c30e29
3 changed files with 33 additions and 8 deletions
|
@ -1,6 +1,16 @@
|
||||||
|
export const ROOT_PATH = "/";
|
||||||
|
|
||||||
// activities
|
// activities
|
||||||
export const ACTIVITIES_PATH = "/client_api/activities";
|
export const ACTIVITIES_PATH = "/client_api/activities";
|
||||||
|
|
||||||
|
// settings
|
||||||
|
export const SETTINGS_PATH = "/settings";
|
||||||
|
export const SETTINGS_ACCOUNT_PATH = "/settings/account";
|
||||||
|
export const SETTINGS_TEAMS_PATH = "/settings/teams";
|
||||||
|
export const SETTINGS_ACCOUNT_PROFILE_PATH = "/settings/account/profile";
|
||||||
|
export const SETTINGS_ACCOUNT_PREFERENCES_PATH =
|
||||||
|
"/settings/account/preferences";
|
||||||
|
|
||||||
// teams
|
// teams
|
||||||
export const TEAMS_PATH = "/client_api/teams";
|
export const TEAMS_PATH = "/client_api/teams";
|
||||||
export const CHANGE_TEAM_PATH = "/client_api/change_team";
|
export const CHANGE_TEAM_PATH = "/client_api/change_team";
|
||||||
|
|
|
@ -5,7 +5,15 @@ import { Nav, NavItem } from "react-bootstrap";
|
||||||
import { FormattedMessage } from "react-intl";
|
import { FormattedMessage } from "react-intl";
|
||||||
import Navigation from "../../../shared/navigation";
|
import Navigation from "../../../shared/navigation";
|
||||||
|
|
||||||
import { SETTINGS_ACCOUNT_PROFILE, SETTINGS_TEAMS } from "../../../app/routes";
|
import {
|
||||||
|
ROOT_PATH,
|
||||||
|
SETTINGS_PATH,
|
||||||
|
SETTINGS_ACCOUNT_PATH,
|
||||||
|
SETTINGS_TEAMS_PATH,
|
||||||
|
SETTINGS_ACCOUNT_PROFILE,
|
||||||
|
SETTINGS_TEAMS,
|
||||||
|
SETTINGS_ACCOUNT_PROFILE_PATH
|
||||||
|
} from "../../../app/routes";
|
||||||
|
|
||||||
import NotFound from "../../../shared/404/NotFound";
|
import NotFound from "../../../shared/404/NotFound";
|
||||||
import SettingsAccount from ".././components/account/SettingsAccount";
|
import SettingsAccount from ".././components/account/SettingsAccount";
|
||||||
|
@ -50,14 +58,14 @@ export default class MainNav extends Component {
|
||||||
</LinkContainer>
|
</LinkContainer>
|
||||||
</Nav>
|
</Nav>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path="/" component={SettingsAccount} />
|
<Route exact path={ROOT_PATH} component={SettingsAccount} />
|
||||||
<Route
|
<Route
|
||||||
exact
|
exact
|
||||||
path="/settings"
|
path={SETTINGS_PATH}
|
||||||
render={() => <Redirect to="/settings/account/profile" />}
|
render={() => <Redirect to={SETTINGS_ACCOUNT_PROFILE_PATH} />}
|
||||||
/>
|
/>
|
||||||
<Route path="/settings/account" component={SettingsAccount} />
|
<Route path={SETTINGS_ACCOUNT_PATH} component={SettingsAccount} />
|
||||||
<Route path="/settings/teams" component={SettingsTeams} />
|
<Route path={SETTINGS_TEAMS_PATH} component={SettingsTeams} />
|
||||||
<Route component={NotFound} />
|
<Route component={NotFound} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,6 +7,10 @@ import SettingsProfile from "./profile/SettingsProfile";
|
||||||
import SettingsPreferences from "./preferences/SettingsPreferences";
|
import SettingsPreferences from "./preferences/SettingsPreferences";
|
||||||
|
|
||||||
import { BORDER_LIGHT_COLOR } from "../../../../app/constants/colors";
|
import { BORDER_LIGHT_COLOR } from "../../../../app/constants/colors";
|
||||||
|
import {
|
||||||
|
SETTINGS_ACCOUNT_PREFERENCES_PATH,
|
||||||
|
SETTINGS_ACCOUNT_PROFILE_PATH
|
||||||
|
} from "../../../../app/routes";
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
background: white;
|
background: white;
|
||||||
|
@ -25,9 +29,12 @@ class SettingsAccount extends Component {
|
||||||
<SettingsLeftTab />
|
<SettingsLeftTab />
|
||||||
</div>
|
</div>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/settings/account/profile" component={SettingsProfile} />
|
|
||||||
<Route
|
<Route
|
||||||
path="/settings/account/preferences"
|
path={SETTINGS_ACCOUNT_PROFILE_PATH}
|
||||||
|
component={SettingsProfile}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
path={SETTINGS_ACCOUNT_PREFERENCES_PATH}
|
||||||
component={SettingsPreferences}
|
component={SettingsPreferences}
|
||||||
/>
|
/>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
|
Loading…
Add table
Reference in a new issue