fix: env to helper function api base url
This commit is contained in:
		@ -26,6 +26,7 @@ import { err } from '@src/lib/trap'
 | 
			
		||||
import type { DeepPartial } from '@src/lib/types'
 | 
			
		||||
import { getInVariableCase } from '@src/lib/utils'
 | 
			
		||||
import { IS_STAGING } from '@src/routes/utils'
 | 
			
		||||
import { withAPIBaseURL } from '@src/lib/withBaseURL'
 | 
			
		||||
 | 
			
		||||
export async function renameProjectDirectory(
 | 
			
		||||
  projectPath: string,
 | 
			
		||||
@ -724,12 +725,9 @@ export const setState = async (state: Project | undefined): Promise<void> => {
 | 
			
		||||
  appStateStore = state
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export const getUser = async (
 | 
			
		||||
  token: string,
 | 
			
		||||
  hostname: string
 | 
			
		||||
): Promise<Models['User_type']> => {
 | 
			
		||||
export const getUser = async (token: string): Promise<Models['User_type']> => {
 | 
			
		||||
  try {
 | 
			
		||||
    const user = await fetch(`${hostname}/users/me`, {
 | 
			
		||||
    const user = await fetch(withAPIBaseURL('/users/me'), {
 | 
			
		||||
      headers: new Headers({
 | 
			
		||||
        Authorization: `Bearer ${token}`,
 | 
			
		||||
      }),
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,5 @@
 | 
			
		||||
import type { Models } from '@kittycad/lib'
 | 
			
		||||
import { VITE_KC_API_BASE_URL, VITE_KC_DEV_TOKEN } from '@src/env'
 | 
			
		||||
import { VITE_KC_DEV_TOKEN } from '@src/env'
 | 
			
		||||
import { assign, fromPromise, setup } from 'xstate'
 | 
			
		||||
 | 
			
		||||
import { COOKIE_NAME, OAUTH2_DEVICE_CLIENT_ID } from '@src/lib/constants'
 | 
			
		||||
@ -148,7 +148,7 @@ async function getUser(input: { token?: string }) {
 | 
			
		||||
  if (token) headers['Authorization'] = `Bearer ${token}`
 | 
			
		||||
 | 
			
		||||
  const userPromise = isDesktop()
 | 
			
		||||
    ? getUserDesktop(token, VITE_KC_API_BASE_URL)
 | 
			
		||||
    ? getUserDesktop(token)
 | 
			
		||||
    : fetch(url, {
 | 
			
		||||
        method: 'GET',
 | 
			
		||||
        credentials: 'include',
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user