forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove OAuth from chrome extension (twentyhq#5528)
Since we can access the tokens directly from cookies of our front app, we don't require the OAuth process to fetch tokens anymore
- Loading branch information
1 parent
fede721
commit f9a3d5f
Showing
5 changed files
with
186 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import { useEffect, useState } from 'react'; | ||
import styled from '@emotion/styled'; | ||
|
||
import { TextInput } from '@/ui/input/components/TextInput'; | ||
import { isDefined } from '~/utils/isDefined'; | ||
|
||
const StyledWrapper = styled.div` | ||
align-items: center; | ||
background: ${({ theme }) => theme.background.primary}; | ||
display: flex; | ||
height: 100vh; | ||
justify-content: center; | ||
`; | ||
|
||
const StyledContainer = styled.div` | ||
width: 400px; | ||
height: 350px; | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
gap: ${({ theme }) => theme.spacing(8)}; | ||
`; | ||
|
||
const StyledActionContainer = styled.div` | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
gap: 10px; | ||
justify-content: center; | ||
width: 300px; | ||
`; | ||
|
||
const Settings = () => { | ||
const [serverBaseUrl, setServerBaseUrl] = useState(''); | ||
const [clientUrl, setClientUrl] = useState(''); | ||
|
||
useEffect(() => { | ||
const getState = async () => { | ||
const store = await chrome.storage.local.get(); | ||
if (isDefined(store.serverBaseUrl)) { | ||
setServerBaseUrl(store.serverBaseUrl); | ||
} else { | ||
setServerBaseUrl(import.meta.env.VITE_SERVER_BASE_URL); | ||
} | ||
|
||
if (isDefined(store.clientUrl)) { | ||
setClientUrl(store.clientUrl); | ||
} else { | ||
setClientUrl(import.meta.env.VITE_FRONT_BASE_URL); | ||
} | ||
}; | ||
void getState(); | ||
}, []); | ||
|
||
const handleBaseUrlChange = (value: string) => { | ||
setServerBaseUrl(value); | ||
chrome.storage.local.set({ serverBaseUrl: value }); | ||
}; | ||
|
||
const handleClientUrlChange = (value: string) => { | ||
setClientUrl(value); | ||
chrome.storage.local.set({ clientUrl: value }); | ||
}; | ||
|
||
return ( | ||
<StyledWrapper> | ||
<StyledContainer> | ||
<img src="/logo/32-32.svg" alt="twenty-logo" height={40} width={40} /> | ||
<StyledActionContainer> | ||
<TextInput | ||
label="Client URL" | ||
value={clientUrl} | ||
onChange={handleClientUrlChange} | ||
placeholder="My client URL" | ||
fullWidth | ||
/> | ||
<TextInput | ||
label="Server URL" | ||
value={serverBaseUrl} | ||
onChange={handleBaseUrlChange} | ||
placeholder="My server URL" | ||
fullWidth | ||
/> | ||
</StyledActionContainer> | ||
</StyledContainer> | ||
</StyledWrapper> | ||
); | ||
}; | ||
|
||
export default Settings; |
Oops, something went wrong.