-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Api fetching started for event page. (#107)
* Added Navbar component to Layout * Fixed Navbar overlapping * Test Workflow * Fixed Navbar overlapping * added footer to layout. fixed navbar links prefetch * changed title,changed icon * Added Complete Events Page * Added mobile css for events page, added winners sections * fixed winners section font * fixed * Added Blogs Page * Deleted some temporary files * Blogs Page Fixes, Changed Projects to Blogs * Added Contact Us page * Jenil's Changes * Bucket env variable changed for all files. * Api fetching for Event page started, also added delete button for admin
- Loading branch information
1 parent
f52a3ad
commit e436f9a
Showing
7 changed files
with
153 additions
and
60 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,28 @@ | ||
import { NextRequest, NextResponse } from "next/server"; | ||
import { createClient } from "@/utils/supabase/server"; | ||
|
||
export async function GET(request: NextRequest): Promise<NextResponse> { | ||
try { | ||
const supabase = createClient(); | ||
const { | ||
data: { user }, | ||
error: userError, | ||
} = await supabase.auth.getUser(); | ||
if (userError || !user) { | ||
return NextResponse.json({ isAdmin: false }, { status: 200 }); | ||
} | ||
const isAdmin = await supabase | ||
.from("users") | ||
.select("admin") | ||
.eq("id", user.id); | ||
|
||
if (isAdmin) { | ||
return NextResponse.json({ isAdmin: true }, { status: 200 }); | ||
} else { | ||
return NextResponse.json({ isAdmin: false }, { status: 200 }); | ||
} | ||
} catch (error) { | ||
console.error(error); | ||
return NextResponse.json({ isAdmin: false }, { status: 200 }); | ||
} | ||
} |
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
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,23 @@ | ||
import { useState, useEffect } from "react"; | ||
import axios from "axios"; | ||
|
||
const checkIsAdmin = () => { | ||
const [isAdmin , setIsAdmin] = useState(false) | ||
useEffect(() => { | ||
const fetchIsAdmin = async () => { | ||
try { | ||
const response = await axios.get(`/api/rest/v1/isUserAdmin`); | ||
const result = response.data; | ||
setIsAdmin(result.isAdmin); | ||
} catch (error) { | ||
console.error(error); | ||
} | ||
}; | ||
|
||
fetchIsAdmin(); | ||
}, [isAdmin]); | ||
|
||
return isAdmin; | ||
}; | ||
|
||
export default checkIsAdmin; |
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
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
e436f9a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deploy preview for iiitvcc ready!
✅ Preview
https://iiitvcc-pelevlbam-iiitv-coding-clubs-projects.vercel.app
Built with commit e436f9a.
This pull request is being automatically deployed with vercel-action