fix user load

pull/4791/head
filip mertens 6 months ago
parent 2c9ecd01c0
commit 38d518d551
  1. 6
      apps/remix-ide/src/app/files/dgitProvider.ts
  2. 7
      libs/remix-ui/git/src/components/github/devicecode.tsx
  3. 2
      libs/remix-ui/git/src/components/panels/commands.tsx
  4. 2
      libs/remix-ui/git/src/components/panels/log.tsx
  5. 20
      libs/remix-ui/git/src/lib/gitactions.ts

@ -1016,14 +1016,12 @@ class DGitProvider extends Plugin {
const user = await octokit.request('GET /user')
const emails = await octokit.request('GET /user/emails')
const scopes = user.headers['x-oauth-scopes'];
console.log('scopes', scopes)
const scopes = user.headers['x-oauth-scopes'] || ''
return {
user: user.data,
emails: emails.data,
scopes: scopes.split(',')
scopes: scopes && scopes.split(',')
}
} catch (e) {
return null

@ -73,13 +73,6 @@ export const GetDeviceCode = () => {
await actions.loadGitHubUserFromToken()
}
const checkConnection = async () => {
//await actions.loadGitHubUserFromToken()
}
useEffect(() => {
}, [])
return (
<>

@ -10,7 +10,5 @@ export const Commands = () => {
<PushPull></PushPull>
<hr></hr>
<Fetch></Fetch>
<hr></hr>
<Merge></Merge>
</>)
}

@ -24,7 +24,7 @@ const LogViewer = () => {
return (
<div className="p-1">
{context.log && context.log.map((log, index) => (
{context.log && context.log.reverse().map((log, index) => (
<div key={index} className={`log-entry ${typeToCssClass(log.type)}`}>
[{log.type.toUpperCase()}] {log.message}
</div>

@ -559,14 +559,22 @@ export const loadGitHubUserFromToken = async () => {
dispatch(setGitHubUser(data.user))
dispatch(setScopes(data.scopes))
dispatch(setUserEmails(data.emails))
}
sendToGitLog({
type: 'success',
message: `Github user loaded...`
})
}else{
const credentials = await getGitHubCredentialsFromLocalStorage()
if (credentials) {
//dispatch(setGitHubUser({ login: credentials.username }))
//dispatch(setUserEmails([{ email: credentials.email, primary: true, visibility: 'public', verified: true }]))
sendToGitLog({
type: 'error',
message: `Please check your GitHub token in the GitHub settings.`
})
dispatch(setGitHubUser(null))
}
} else {
sendToGitLog({
type: 'error',
message: `Please check your GitHub token in the GitHub settings.`
})
dispatch(setGitHubUser(null))
}
} catch (e) {

Loading…
Cancel
Save