Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Api Server #43

Draft
wants to merge 29 commits into
base: rewrite
Choose a base branch
from
Draft

feature: Api Server #43

wants to merge 29 commits into from

Conversation

l7ssha
Copy link
Member

@l7ssha l7ssha commented Dec 9, 2024

No description provided.

frontend/src/component/NavigationBar.tsx Outdated Show resolved Hide resolved
frontend/src/component/NavigationBar.tsx Outdated Show resolved Hide resolved
frontend/src/component/NavigationBar.tsx Outdated Show resolved Hide resolved
frontend/src/component/NavigationBar.tsx Outdated Show resolved Hide resolved
frontend/src/component/ProtectedRoute.tsx Outdated Show resolved Hide resolved
frontend/src/page/admin/Guilds.tsx Outdated Show resolved Hide resolved
frontend/src/service/auth.ts Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we use axios?
fetch is globally available.

frontend/src/service/useApi.ts Outdated Show resolved Hide resolved
frontend/src/service/useApi.ts Outdated Show resolved Hide resolved
message: string
}

export async function request<T extends object>({path, method = 'GET', auth = false}: FetchParams) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export async function request<T extends object>({path, method = 'GET', auth = false}: FetchParams) {
export async function request<T extends Record<string | number, unknown> | unknown[]>({path, method = 'GET', auth = false}: FetchParams) {

extends object is certainly not what you want here, with the extends object clause will allow any object, e.g request<string>() is perfectly valid.

export const discordLoginUri = encodeURI(`https://discord.com/oauth2/authorize?client_id=${process.env.REACT_APP_CLIENT_ID}&response_type=code&redirect_uri=${process.env.REACT_APP_REDIRECT_URL}&scope=identify+guilds`);

export function getUserAvatar(id: string, hash: string) {
return `https://media.discordapp.net/avatars/${id}/${hash}.png?size=64`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the cdn, not the media proxy

frontend/src/page/admin/Guilds.tsx Outdated Show resolved Hide resolved
frontend/src/service/api.ts Outdated Show resolved Hide resolved
frontend/src/service/api.ts Outdated Show resolved Hide resolved
frontend/src/page/Home.tsx Outdated Show resolved Hide resolved
frontend/src/page/Home.tsx Outdated Show resolved Hide resolved
frontend/src/page/admin/GuildDetails.tsx Outdated Show resolved Hide resolved
frontend/src/page/admin/GuildDetails.tsx Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants