mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-06-17 18:09:09 +00:00
Reach parity with last web iteration. (#162)
* feat: add Api and Session contexts * feat(web): add machinery/new-session * feat(web): add servers page * chore(web): AppRouter spacing/ordering * feat(web): add picker, missing update-roles call for now * feat(web): add picker saves * chore: add roleTransactions tests * feat(web): add auth/login
This commit is contained in:
parent
f65779f925
commit
cd448b56c9
20 changed files with 567 additions and 7 deletions
51
packages/web/src/pages/dev-tools/set-api.tsx
Normal file
51
packages/web/src/pages/dev-tools/set-api.tsx
Normal file
|
@ -0,0 +1,51 @@
|
|||
import { navigate } from '@reach/router';
|
||||
import * as React from 'react';
|
||||
import { useApiContext } from '../../api-context/ApiContext';
|
||||
|
||||
const SetApi = () => {
|
||||
const apiContext = useApiContext();
|
||||
const [apiField, setApiField] = React.useState(apiContext.apiUrl);
|
||||
|
||||
const setApi = () => {
|
||||
// Clear storage to get rid of old API data
|
||||
localStorage.clear();
|
||||
sessionStorage.clear();
|
||||
|
||||
apiContext.setApiUrl(apiField);
|
||||
|
||||
navigate('/');
|
||||
};
|
||||
|
||||
const quickSettingClick = (url: string) => () => {
|
||||
setApiField(url);
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div>
|
||||
<input
|
||||
type="text"
|
||||
value={apiField}
|
||||
onChange={(ev) => {
|
||||
setApiField(ev.target.value);
|
||||
}}
|
||||
/>
|
||||
<button onClick={setApi}>Set & Go</button>
|
||||
</div>
|
||||
<div>
|
||||
Quick Settings:
|
||||
<button onClick={quickSettingClick('https://api-prod.roleypoly.com')}>
|
||||
Production (api-prod)
|
||||
</button>
|
||||
<button onClick={quickSettingClick('https://api-stage.roleypoly.com')}>
|
||||
Staging (api-stage)
|
||||
</button>
|
||||
<button onClick={quickSettingClick('http://localhost:6609')}>
|
||||
Local (:6609)
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default SetApi;
|
Loading…
Add table
Add a link
Reference in a new issue