Skip to content

Commit

Permalink
fix: minor convention fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
SamCaliman committed Jul 4, 2024
1 parent 68683e6 commit 514cb86
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 42 deletions.
3 changes: 0 additions & 3 deletions api/.aeria/aeria-sdk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,6 @@ declare type MirrorRouter = {
},
"/github/githubAuth": {
"POST": null
},
"/user/createGithubUser": {
"POST": null
}
}

Expand Down
9 changes: 3 additions & 6 deletions api/src/routes/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,19 @@ githubRouter.POST('/githubAuth', async(context)=>{
})

if(userError){
const gitUserId = gitTempUser.id
const { error: userInsertError, result: userInsertResult } = await context.collections.user.functions.insert({
what: {
name: gitTempUser.login,
active: true,
github_id: gitUserId.toString(),
github_id: gitTempUser.id.toString(),
roles: ['root'],
email: `${gitTempUser.login}@user.github.com`,
},
})
if (userInsertError){
return context.error(HTTPStatus.InternalServerError, {code: userInsertError.code})
return Result.error(userInsertError)
}
return Result.result(await successfulAuthentication(userInsertResult._id, context))
}
if (user){
return Result.result(await successfulAuthentication(user._id, context))
}
return Result.result(await successfulAuthentication(user._id, context))
})
2 changes: 0 additions & 2 deletions api/src/routes/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createRouter, Result } from 'aeria'
import { githubRouter } from './github.js'
import { userRouter } from './user.js'

export const router = createRouter()

Expand All @@ -18,4 +17,3 @@ router.GET('/test', async (context) => {
})

router.group('/github', githubRouter)
router.group('/user', userRouter)
12 changes: 0 additions & 12 deletions api/src/routes/user.ts

This file was deleted.

3 changes: 0 additions & 3 deletions web/.aeria-ui/aeria-sdk.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,6 @@ declare type MirrorRouter = {
},
"/github/githubAuth": {
"POST": null
},
"/user/createGithubUser": {
"POST": null
}
}

Expand Down
10 changes: 0 additions & 10 deletions web/src/pages/dashboard/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,8 @@ definePage({
},
})
async function githubAuth() {
const CLIENT_ID = import.meta.env.VITE_GITHUB_CLIENT_ID
console.log(CLIENT_ID)
if(CLIENT_ID){
window.open(`https://github.com/login/oauth/authorize?client_id=${CLIENT_ID}`)
}
}
</script>

<template>
<h1>Welcome</h1>
<aeria-button @click="githubAuth()">clique</aeria-button>
</template>
12 changes: 6 additions & 6 deletions web/src/pages/redirect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ onMounted(async ()=>{
const {error,result}: Result.Either<EndpointError, SuccessfulAuthentication>= await aeria.github.githubAuth.POST({
code: gitTempCode
}) as any
console.log(result)
if(result){
userStore.$actions.setCurrentUser(result)
window.open('http://localhost:8080/dashboard', '_self')
}
if(error){
window.open('http://localhost:8080/githubAuth')
router.push('/githubAuth')
//window.open('http://localhost:8080/githubAuth', '_self')
return
}
userStore.$actions.setCurrentUser(result)
router.push('/dashboard')
//window.open('http://localhost:8080/dashboard', '_self')
}
})
Expand Down

0 comments on commit 514cb86

Please sign in to comment.