Prettier format pending files

This commit is contained in:
Builder.io 2025-11-16 09:32:17 +00:00
parent 80bfbea1c6
commit a7d614e9ed
7 changed files with 43 additions and 46 deletions

View file

@ -44,7 +44,8 @@ export interface ApplicationWithCreator {
};
}
const getApiBase = () => typeof window !== "undefined" ? window.location.origin : "";
const getApiBase = () =>
typeof window !== "undefined" ? window.location.origin : "";
export async function getMyApplications(filters?: {
status?: string;
@ -107,11 +108,8 @@ export async function withdrawApplication(
): Promise<void> {
const apiBase = getApiBase();
if (!apiBase) throw new Error("No API base available");
const response = await fetch(
`${apiBase}/api/applications/${applicationId}`,
{
method: "DELETE",
},
);
const response = await fetch(`${apiBase}/api/applications/${applicationId}`, {
method: "DELETE",
});
if (!response.ok) throw new Error("Failed to withdraw application");
}

View file

@ -51,7 +51,8 @@ export interface CreatorsResponse {
};
}
const getApiBase = () => typeof window !== "undefined" ? window.location.origin : "";
const getApiBase = () =>
typeof window !== "undefined" ? window.location.origin : "";
export async function getCreators(filters?: {
arm?: string;
@ -170,13 +171,10 @@ export async function endorseSkill(
): Promise<void> {
const apiBase = getApiBase();
if (!apiBase) throw new Error("No API base available");
const response = await fetch(
`${apiBase}/api/creators/${creatorId}/endorse`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ skill }),
},
);
const response = await fetch(`${apiBase}/api/creators/${creatorId}/endorse`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ skill }),
});
if (!response.ok) throw new Error("Failed to endorse skill");
}

View file

@ -397,7 +397,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
rewardsActivatedRef.current = true;
// Only attempt to activate if this is the admin user
if (profile?.email === "mrpiglr@gmail.com" || profile?.username === "mrpiglr") {
if (
profile?.email === "mrpiglr@gmail.com" ||
profile?.username === "mrpiglr"
) {
aethexAchievementService
.activateCommunityRewards({
email: profile?.email,

View file

@ -301,7 +301,10 @@ export const aethexUserService = {
await this.updateProfile(user.id, {
username: "mrpiglr",
}).catch((err) => {
console.warn("[Profile] Failed to auto-populate mrpiglr username:", err);
console.warn(
"[Profile] Failed to auto-populate mrpiglr username:",
err,
);
});
normalized.username = "mrpiglr";
}
@ -1001,7 +1004,8 @@ export const aethexAchievementService = {
ensureSupabase();
try {
const baseUrl = typeof window !== "undefined" ? window.location.origin : "";
const baseUrl =
typeof window !== "undefined" ? window.location.origin : "";
if (!baseUrl) {
console.warn("[Achievement] Cannot award - no origin available");
return;
@ -1082,12 +1086,11 @@ export const aethexAchievementService = {
// Always use the current origin for API calls since the API is served from the same origin
// This works for both development (localhost:8080) and production (aethex.dev)
const baseUrl = typeof window !== "undefined" ? window.location.origin : "";
const baseUrl =
typeof window !== "undefined" ? window.location.origin : "";
if (!baseUrl) {
console.warn(
"[Rewards] Cannot activate - no origin available",
);
console.warn("[Rewards] Cannot activate - no origin available");
return null;
}

View file

@ -262,8 +262,7 @@ export default function Login() {
nonce: nonce.nonce,
signature,
redirectTo:
window.location.origin +
(profile ? "/dashboard" : "/onboarding"),
window.location.origin + (profile ? "/dashboard" : "/onboarding"),
}),
})
.then((r) => (r.ok ? r.json() : null))

View file

@ -33,7 +33,8 @@ import { CoursesWidget } from "@/components/CoursesWidget";
import { MentorshipWidget } from "@/components/MentorshipWidget";
import { AchievementsWidget } from "@/components/AchievementsWidget";
const getApiBase = () => typeof window !== "undefined" ? window.location.origin : "";
const getApiBase = () =>
typeof window !== "undefined" ? window.location.origin : "";
export default function FoundationDashboard() {
const navigate = useNavigate();
@ -81,12 +82,9 @@ export default function FoundationDashboard() {
console.warn("[Foundation] No API base available");
return;
}
const mentorRes = await fetch(
`${apiBase}/api/foundation/mentorships`,
{
headers: { Authorization: `Bearer ${token}` },
},
);
const mentorRes = await fetch(`${apiBase}/api/foundation/mentorships`, {
headers: { Authorization: `Bearer ${token}` },
});
if (
mentorRes.ok &&
mentorRes.headers.get("content-type")?.includes("application/json")

View file

@ -36,7 +36,8 @@ import {
ToggleRight,
} from "lucide-react";
const getApiBase = () => typeof window !== "undefined" ? window.location.origin : "";
const getApiBase = () =>
typeof window !== "undefined" ? window.location.origin : "";
type ViewMode = "creator" | "client";
@ -234,20 +235,17 @@ export default function NexusDashboard() {
setCreatorProfile(updatedProfile);
// Update user profile to mark Nexus as complete
const userProfileRes = await fetch(
`${apiBase}/api/user/profile-update`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
nexus_profile_complete: true,
nexus_headline: profileFormData.headline,
}),
const userProfileRes = await fetch(`${apiBase}/api/user/profile-update`, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
);
body: JSON.stringify({
nexus_profile_complete: true,
nexus_headline: profileFormData.headline,
}),
});
if (userProfileRes.ok) {
aethexToast({