Skip to content

Commit

Permalink
fixed an issue that i don't understand
Browse files Browse the repository at this point in the history
  • Loading branch information
ForwardFeed committed Nov 15, 2024
1 parent a23fb4e commit cf8fa15
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export type VersionsAvailable = (typeof versionsAvailable)[number]


export const config: GeneralConfig = {
appName: "ER-Taillow",
base: "/taillow/", // github.io stuff
}
2 changes: 1 addition & 1 deletion config_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ export type ConfigData<T extends string> = {


export type GeneralConfig = {
appName: string,
base: string,
}
6 changes: 3 additions & 3 deletions ui/src/composable/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useErrorStore } from "@/stores/errors";
import { wrapperLocalStorage, type AllowedSaveableGameData } from "@/utils/localstorage";
import { ref, type Ref } from "vue";
import viteConfig from "../../vite.config"
import { config } from "../../../config";

export enum FetchState{
fetching,
Expand All @@ -14,7 +14,7 @@ export enum FetchState{
export function useFetchJson<T>(url: string, callback: (t:T)=>void, noCache = false): Ref<FetchState>{
const errorStore = useErrorStore()
const state = ref(FetchState.fetching)
fetch(viteConfig.base + url, noCache ? {cache: "no-store"} : {})
fetch(config.base + url, noCache ? {cache: "no-store"} : {})
.then((res)=>{
state.value = FetchState.parsing
const contentType = res.headers.get("content-type");
Expand Down Expand Up @@ -52,7 +52,7 @@ export function useFetchJson<T>(url: string, callback: (t:T)=>void, noCache = fa
export function useFetchGzip<T>(url: string, callback: (t:T)=>void, savekey?: AllowedSaveableGameData): Ref<FetchState>{
const errorStore = useErrorStore()
const state = ref(FetchState.fetching)
fetch(viteConfig.base + url)
fetch(config.base + url)
.then((res)=>{
state.value = FetchState.parsing
//@ts-ignore
Expand Down
2 changes: 1 addition & 1 deletion ui/src/utils/localstorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function isQuotaExceededError(err: unknown): boolean {
* Since most people uses github.io as free hosting service for those kind of projects in 2024
* It would collide as localstorage is "bound to the website origin".
*/
const APP_NAME = config.appName
const APP_NAME = config.base
// some outdated browsers don't support localstorage (often A**le)
// which is my fear and is a reason why I guard localstorage with this wrapper.
// Also there's space limits, and once the limit is reached,
Expand Down
3 changes: 2 additions & 1 deletion ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { config } from "../config"

// https://vitejs.dev/config/
export default defineConfig({
Expand All @@ -13,5 +14,5 @@ export default defineConfig({
'@': fileURLToPath(new URL('./src', import.meta.url))
}
},
base: '/taillow/' // github.io stuff
base: config.base
})

0 comments on commit cf8fa15

Please sign in to comment.