Update default API URL

Update the default Supabase API URL to http://a11.ism.kr.
This commit is contained in:
gpt-engineer-app[bot]
2025-03-15 15:20:26 +00:00
parent 0f07edaa98
commit 9e7cd1f074
3 changed files with 39 additions and 5 deletions

View File

@@ -3,11 +3,35 @@
* 서버 URL 검증
*/
export const validateServerUrl = (url: string): boolean => {
if (!url || url.trim() === '') {
return false;
}
try {
// URL에 프로토콜이 없는 경우 http:// 추가
const urlWithProtocol = url.match(/^https?:\/\//) ? url : `http://${url}`;
// URL 유효성 검사
new URL(url);
new URL(urlWithProtocol);
return true;
} catch (e) {
return false;
}
};
/**
* API 경로 정규화 함수
*/
export const normalizeApiPath = (baseUrl: string, path: string): string => {
// 마지막 슬래시 제거
const normalizedBase = baseUrl.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;
// 앞 슬래시 추가
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
// 이미 경로가 포함되어 있는지 확인하고 중복 방지
if (normalizedBase.endsWith(normalizedPath)) {
return normalizedBase;
}
return `${normalizedBase}${normalizedPath}`;
};