-
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.
* update * Update index.tsx * update * Update index.tsx * Update index.tsx * Update index.tsx * fix: add missing auth header * fix: pool page taking in params * fix: add mongo types + fix patch request --------- Co-authored-by: marcuspang <[email protected]>
- Loading branch information
1 parent
9e5e7de
commit aafebed
Showing
4 changed files
with
97 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { AuthContext } from "@/components/AuthProvider"; | ||
import { User } from "@/types/mongo"; | ||
import { useContext } from "react"; | ||
import { useQuery } from "wagmi"; | ||
|
||
async function getCurrentUser(idToken: string): Promise<User | undefined> { | ||
try { | ||
return fetch(`${process.env.BACKEND_URL}/users/@me`, { | ||
headers: { | ||
Authorization: `Bearer ${idToken}`, | ||
} | ||
}).then((res) => | ||
res.json() | ||
); | ||
} catch (e) { | ||
console.error(e); | ||
return; | ||
} | ||
} | ||
|
||
export function useGetCurrentUser() { | ||
const { idToken } = useContext(AuthContext); | ||
|
||
return useQuery(["users"], () => getCurrentUser(idToken), { enabled: idToken !== '' }); | ||
} |
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,11 +1,11 @@ | ||
import { FundingPoolProjectHeader } from "@/devlink"; | ||
import { ReadyToLaunchComponent } from "@/devlink/ReadyToLaunchComponent"; | ||
|
||
export default function PoolPage({ params }: { params: { slug: string } }) { | ||
export default function PoolPage() { | ||
return ( | ||
<> | ||
<FundingPoolProjectHeader /> | ||
<ReadyToLaunchComponent /> | ||
<FundingPoolProjectHeader /> | ||
<ReadyToLaunchComponent /> | ||
</> | ||
); | ||
} |
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