forked from ubiquity/pay.ubq.fi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: comments, clean-up and loose ends
- Loading branch information
Showing
12 changed files
with
581 additions
and
563 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
import ClaimsPortal from "./components/claims-portal"; | ||
import { SupabaseServerClient } from "./scripts/rewards/account-abstraction/supabase-server-client"; | ||
|
||
async function loadUserData() { | ||
async function loadUserData(permits: string) { | ||
const supabase = SupabaseServerClient.getInstance(); | ||
const { | ||
data: { user }, | ||
} = await supabase.getSupabaseUser(); | ||
|
||
const githubUser = await supabase.getGitHubUser(); | ||
if (!user) { | ||
try { | ||
await supabase.loginWithGitHub(permits); | ||
} catch (error) { | ||
console.error("Failed to login", error); | ||
} | ||
} | ||
|
||
return { user, githubUser }; | ||
return { user }; | ||
} | ||
|
||
export default async function Page(params: { searchParams: { claim: string } }) { | ||
const permitData = params.searchParams.claim; | ||
|
||
const { user, githubUser } = await loadUserData(); | ||
const { user } = await loadUserData(permitData); | ||
|
||
if (permitData && user && githubUser) { | ||
return <ClaimsPortal permits={permitData} githubUser={githubUser} supabaseUser={user} />; | ||
} | ||
return <ClaimsPortal permits={permitData} supabaseUser={user} />; | ||
|
||
/** | ||
* good idea to have section for account setup, options, etc. here if we don't have a permit | ||
*/ | ||
|
||
// return <ClaimsPortal permits={permitData} githubUser={githubUser} supabaseUser={user} />; | ||
* | ||
*/ | ||
} |
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
Oops, something went wrong.