Fix circular dep
This commit is contained in:
@ -1,5 +1,3 @@
|
|||||||
import { VITE_KC_KCL_SAMPLES_REF } from 'env'
|
|
||||||
|
|
||||||
export const APP_NAME = 'Modeling App'
|
export const APP_NAME = 'Modeling App'
|
||||||
/** Search string in new project names to increment as an index */
|
/** Search string in new project names to increment as an index */
|
||||||
export const INDEX_IDENTIFIER = '$n'
|
export const INDEX_IDENTIFIER = '$n'
|
||||||
@ -107,7 +105,8 @@ export const MAKE_TOAST_MESSAGES = {
|
|||||||
|
|
||||||
/** The URL for the KCL samples manifest files */
|
/** The URL for the KCL samples manifest files */
|
||||||
export const KCL_SAMPLES_MANIFEST_URLS = {
|
export const KCL_SAMPLES_MANIFEST_URLS = {
|
||||||
remote: `https://raw.githubusercontent.com/KittyCAD/kcl-samples/${VITE_KC_KCL_SAMPLES_REF}/manifest.json`,
|
// TODO: enable remote fetching again, maybe?
|
||||||
|
// remote: `https://raw.githubusercontent.com/KittyCAD/kcl-samples/${VITE_KC_KCL_SAMPLES_REF}/manifest.json`,
|
||||||
localFallback: '/kcl-samples-manifest-fallback.json',
|
localFallback: '/kcl-samples-manifest-fallback.json',
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
|
|||||||
@ -10,23 +10,27 @@ export type KclSamplesManifestItem = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getKclSamplesManifest() {
|
export async function getKclSamplesManifest() {
|
||||||
let response = await fetch(KCL_SAMPLES_MANIFEST_URLS.remote)
|
// TODO: enable remote fetching again, maybe?
|
||||||
if (!response.ok) {
|
// let response = await fetch(KCL_SAMPLES_MANIFEST_URLS.remote)
|
||||||
console.warn(
|
// if (!response.ok) {
|
||||||
'Failed to fetch latest remote KCL samples manifest, falling back to local:',
|
// console.warn(
|
||||||
response.statusText
|
// 'Failed to fetch latest remote KCL samples manifest, falling back to local:',
|
||||||
)
|
// response.statusText
|
||||||
response = await fetch(
|
// )
|
||||||
|
// response = await fetch(
|
||||||
|
// (isDesktop() ? '.' : '') + KCL_SAMPLES_MANIFEST_URLS.localFallback
|
||||||
|
// )
|
||||||
|
// if (!response.ok) {
|
||||||
|
// console.error(
|
||||||
|
// 'Failed to fetch fallback KCL samples manifest:',
|
||||||
|
// response.statusText
|
||||||
|
// )
|
||||||
|
// return []
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
const response = await fetch(
|
||||||
(isDesktop() ? '.' : '') + KCL_SAMPLES_MANIFEST_URLS.localFallback
|
(isDesktop() ? '.' : '') + KCL_SAMPLES_MANIFEST_URLS.localFallback
|
||||||
)
|
)
|
||||||
if (!response.ok) {
|
|
||||||
console.error(
|
|
||||||
'Failed to fetch fallback KCL samples manifest:',
|
|
||||||
response.statusText
|
|
||||||
)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return response.json().then((manifest) => {
|
return response.json().then((manifest) => {
|
||||||
return manifest as KclSamplesManifestItem[]
|
return manifest as KclSamplesManifestItem[]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user