The API endpoint URL to check
True if the endpoint is used for auth checks
if (isAuthCheckEndpoint("/api/user/info")) {
// Handle potential 1005 auth failure response
}
export function isAuthCheckEndpoint(url: string): boolean {
// Widen the enum-value array to string[] so .includes accepts an
// arbitrary string argument (the array element type is the enum union).
return (
[
ApiEndpoints.USER_INFO,
ApiEndpoints.FRUIT_HEAD,
ApiEndpoints.FAVOURITE_ADD,
ApiEndpoints.FRUIT_ADD,
] as string[]
).includes(url);
}
Validates if a URL is an authentication check endpoint. These endpoints are used to verify the user's authentication status and will return a specific error code (1005) if authentication fails.