[Chore] All api urls are now using the helper function (#7672)

* fix: logging information about the login

* chore: improving the withBaseURL workflow

* chore: moving VITE_KC_API_BASE_URL to the helper function

* fix: env to helper function api base url

* chore: fixing another api base url

* chore: shortlinks with base api helper function

* chore: prompt edit with base helper function

* fix: auto fmt

* fix: withAPIBaseURL for all urls

* fix: AI caught my typo, RIP

* fix: expected

* fix: renaming this so it is less specific to environment

---------

Co-authored-by: Jace Browning <jacebrowning@gmail.com>
This commit is contained in:
Kevin Nadro
2025-07-03 08:54:03 -05:00
committed by GitHub
parent e5d082f441
commit df6256266c
13 changed files with 104 additions and 46 deletions

View File

@ -1,4 +1,4 @@
import { VITE_KC_API_BASE_URL, VITE_KC_SITE_APP_URL } from '@src/env'
import { VITE_KC_SITE_APP_URL } from '@src/env'
import toast from 'react-hot-toast'
import { stringToBase64 } from '@src/lib/base64'
@ -7,6 +7,7 @@ import {
CREATE_FILE_URL_PARAM,
} from '@src/lib/constants'
import { err } from '@src/lib/trap'
import { withAPIBaseURL } from '@src/lib/withBaseURL'
export interface FileLinkParams {
code: string
@ -96,7 +97,7 @@ export async function createShortlink(
if (password) {
body.password = password
}
const response = await fetch(`${VITE_KC_API_BASE_URL}/user/shortlinks`, {
const response = await fetch(withAPIBaseURL('/user/shortlinks'), {
method: 'POST',
headers: {
'Content-type': 'application/json',