🧹 Clean up code formatting and fix minor syntax inconsistencies in useDiscordOAuth.js
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
/**
|
||||
* Discord OAuth Composable
|
||||
*
|
||||
*
|
||||
* Thin wrapper around useOAuth for Discord-specific flows
|
||||
* Handles Discord user profile fetching and username access
|
||||
*
|
||||
*
|
||||
* Usage:
|
||||
* const discord = useDiscordOAuth();
|
||||
* discord.login();
|
||||
@@ -41,7 +41,7 @@ export function useDiscordOAuth() {
|
||||
/**
|
||||
* Fetch Discord user profile from backend
|
||||
* Backend will use the stored Discord token to fetch from Discord API
|
||||
*
|
||||
*
|
||||
* @returns {Promise<Object>} Discord user profile
|
||||
* @throws {Error} If fetch fails
|
||||
*/
|
||||
@@ -55,7 +55,7 @@ export function useDiscordOAuth() {
|
||||
// Fetch from backend which has the Discord token
|
||||
const response = await fetch('/api/auth/discord/profile', {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${token}`
|
||||
Authorization: `Bearer ${token}`
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ export function useDiscordOAuth() {
|
||||
|
||||
const data = await response.json();
|
||||
discordUser.value = data.user;
|
||||
|
||||
|
||||
console.log(`✅ Loaded Discord profile: ${data.user.username}`);
|
||||
return data.user;
|
||||
} catch (err) {
|
||||
@@ -78,7 +78,7 @@ export function useDiscordOAuth() {
|
||||
/**
|
||||
* Login with Discord
|
||||
* Uses identify scope only for minimal permissions
|
||||
*
|
||||
*
|
||||
* @param {Object} options - Optional options (return_to, etc.)
|
||||
*/
|
||||
function login(options = {}) {
|
||||
@@ -99,7 +99,7 @@ export function useDiscordOAuth() {
|
||||
/**
|
||||
* Check if user is allowed to access developer tools
|
||||
* Compares Discord username against backend-managed allowlist
|
||||
*
|
||||
*
|
||||
* @param {Object} userPermissions - User permissions object from backend
|
||||
* @returns {boolean} True if user has developer access
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user