Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions fake-snippets-api/routes/api/accounts/get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default withRouteSpec({
methods: ["GET", "POST"],
auth: "session",
commonParams: z.object({
tscircuit_handle: z.string().optional(),
github_username: z.string().optional(),
}),
jsonResponse: z.object({
Expand All @@ -19,8 +20,16 @@ export default withRouteSpec({
}),
})(async (req, ctx) => {
let account: Account | undefined
const { github_username } = req.commonParams
if (github_username) {
const { github_username, tscircuit_handle } = req.commonParams
if (tscircuit_handle) {
const foundAccount = ctx.db.accounts.find(
(acc: Account) =>
acc.tscircuit_handle?.toLowerCase() === tscircuit_handle.toLowerCase(),
)
if (foundAccount) {
account = { ...foundAccount, email: undefined }
}
} else if (github_username) {
const foundAccount = ctx.db.accounts.find(
(acc: Account) =>
acc.github_username?.toLowerCase() === github_username.toLowerCase(),
Expand Down
2 changes: 1 addition & 1 deletion src/pages/user-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export default function UserSettingsPage() {
const userInfo = [
{
label: "GitHub Username",
value: account?.github_username || "Not available",
value: account?.github_username || "Not connected",
},
{
label: "Email",
Expand Down