The weeb for the next gen discord boat - Wamellow wamellow.com
bot discord
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

update api responses

Luna 49e15c6d c3004431

+26 -26
+1 -1
app/ai-gallery/[uploadId]/page.tsx
··· 16 16 const { uploadId } = await params; 17 17 18 18 const upload = await getUpload(uploadId); 19 - if (!upload || "statusCode" in upload) return; 19 + if (!upload || "status" in upload) return; 20 20 21 21 const src = `https://r2.wamellow.com/ai-image/${upload.id}.webp`; 22 22
+1 -1
app/login/route.ts
··· 73 73 const res = await createSession(code); 74 74 let redirectUrl = getRedirectUrl(searchParams); 75 75 76 - if (!res || "statusCode" in res) { 76 + if (!res || "status" in res) { 77 77 const data = { statusCode: 500, message: res?.message || "An error occurred" }; 78 78 console.log(data); 79 79
+4 -4
app/login/spotify/api.ts
··· 1 1 import type { ApiError } from "@/typings"; 2 2 3 - export async function connectSpotify(code: string, session: string): Promise<true | ApiError> { 3 + export async function connectSpotify(code: string, session: string): Promise<{ success: boolean; } | ApiError> { 4 4 const res = await fetch(`${process.env.NEXT_PUBLIC_API}/users/@me/connections/spotify`, { 5 5 method: "PUT", 6 6 headers: { ··· 13 13 }) 14 14 }); 15 15 16 - return res.ok ? true : await res.json(); 16 + return res.json(); 17 17 } 18 18 19 - export async function disconnectSpotify(session: string): Promise<true | ApiError> { 19 + export async function disconnectSpotify(session: string): Promise<{ success: boolean; } | ApiError> { 20 20 const res = await fetch(`${process.env.NEXT_PUBLIC_API}/users/@me/connections/spotify`, { 21 21 method: "DELETE", 22 22 headers: { ··· 26 26 } 27 27 }); 28 28 29 - return res.ok ? true : await res.json(); 29 + return res.json(); 30 30 }
+6 -7
app/login/spotify/route.ts
··· 15 15 } 16 16 17 17 if (logout) { 18 - 19 18 const res = await disconnectSpotify(session.value); 20 19 21 20 if ( 22 - (res !== true || typeof res !== "boolean" && "statusCode" in res) && 23 - res?.statusCode !== 401 21 + "status" in res && 22 + res?.status !== 401 24 23 ) { 25 - const data = { statusCode: 500, message: res?.message || "An error occurred" }; 24 + const data = { status: 500, message: res?.message || "An error occurred" }; 26 25 console.log(data); 27 26 return Response.json(data); 28 27 } ··· 39 38 const res = await connectSpotify(code, session.value); 40 39 41 40 if ( 42 - (res !== true || typeof res !== "boolean" && "statusCode" in res) && 43 - res?.statusCode !== 401 41 + "status" in res && 42 + res?.status !== 401 44 43 ) { 45 - const data = { statusCode: 500, message: res?.message || "An error occurred" }; 44 + const data = { status: 500, message: res?.message || "An error occurred" }; 46 45 console.log(data); 47 46 return Response.json(data); 48 47 }
+3 -4
app/passport/[guildId]/api.ts
··· 1 - import type { ApiError, ApiV1GuildsModulesPassportGetResponse } from "@/typings"; 1 + import type { ApiError } from "@/typings"; 2 2 3 - export async function getPassport(guildId: string): Promise<ApiV1GuildsModulesPassportGetResponse | true | ApiError | undefined> { 3 + export async function getPassport(guildId: string): Promise<{ enabled: boolean; } | ApiError | undefined> { 4 4 const res = await fetch(`${process.env.NEXT_PUBLIC_API}/guilds/${guildId}/passport-verification`, { 5 5 headers: { Authorization: process.env.API_SECRET as string }, 6 6 next: { revalidate: 60 } 7 7 }); 8 8 9 - const passport = await res.json(); 10 - return passport; 9 + return res.json(); 11 10 }
+4 -2
app/passport/[guildId]/page.tsx
··· 69 69 const guildExists = guild && "id" in guild; 70 70 71 71 return (<> 72 - {typeof passport === "object" && "message" in passport && 72 + {passport && "message" in passport && 73 73 <Notice type={NoticeType.Error} message={passport.message} /> 74 74 } 75 75 ··· 147 147 148 148 { 149 149 guildExists && 150 - passport === true && 150 + passport && 151 + "enabled" in passport && 152 + passport.enabled && 151 153 <Verify 152 154 guild={guild} 153 155 isLoggedIn={Boolean(jar.get("token")?.value)}
+1 -1
app/passport/[guildId]/verify.component.tsx
··· 27 27 return ( 28 28 <div className="flex flex-col gap-3 w-full mt-4"> 29 29 30 - <Badge className="relative top-[3px] ml-0.5 w-fit h-6"> 30 + <Badge className="relative top-[3px] ml-0.5 w-fit h-6" radius="rounded"> 31 31 <ImageReduceMotion 32 32 className="rounded-full size-5 relative right-1 -ml-[5px]" 33 33 alt="your avatar"
+1 -1
app/profile/layout.tsx
··· 41 41 enabled: !!user?.id, 42 42 onSuccess: (d) => userStore.setState({ 43 43 ...user, 44 - extended: "statusCode" in d ? {} : d 44 + extended: "status" in d ? {} : d 45 45 }), 46 46 ...cacheOptions 47 47 }
+2 -2
app/profile/spotify/page.tsx
··· 31 31 cacheOptions 32 32 ); 33 33 34 - if (error || (data && "message" in data && data.statusCode !== 404)) { 34 + if (error || (data && "message" in data && data.status !== 404)) { 35 35 return ( 36 36 <ScreenMessage 37 37 title="Something went wrong on this page.." ··· 53 53 return ( 54 54 <div className="h-full"> 55 55 56 - {"statusCode" in data && 56 + {"status" in data && 57 57 <ScreenMessage 58 58 title="Nothing to see here.. yet.." 59 59 description="Cool things will come soon"
+1 -1
components/embed-creator.tsx
··· 120 120 .then((r) => r.json()) 121 121 .catch(() => null); 122 122 123 - if (!res || "statusCode" in res) { 123 + if (!res || "status" in res) { 124 124 setState(State.Idle); 125 125 setError( 126 126 "message" in res
+1 -1
typings.ts
··· 2 2 import { actor } from "./utils/tts"; 3 3 4 4 export interface ApiError { 5 - statusCode: number; 5 + status: number; 6 6 message: string; 7 7 } 8 8
+1 -1
utils/authorize-user.ts
··· 22 22 .then((res) => res.json()) 23 23 .catch(() => null) as User | ApiError | null; 24 24 25 - if (res && "statusCode" in res && res.statusCode.toString().startsWith("4")) { 25 + if (res && "status" in res && res.status.toString().startsWith("4")) { 26 26 window.location.href = "/login"; 27 27 return null; 28 28 }