Skip to content

Commit

Permalink
chore: bump to v0.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
blinko-space committed Jan 7, 2025
1 parent 9df21eb commit 0facbe7
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "blinko-snap",
"private": true,
"version": "0.1.1",
"version": "0.1.2",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Blinko Snap",
"version": "0.1.1",
"version": "0.1.2",
"identifier": "com.blinko-snap.app",
"build": {
"beforeDevCommand": "pnpm run dev",
Expand Down
3 changes: 3 additions & 0 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ interface ApiConfig extends AxiosRequestConfig {
export const api = async (url: string, method: 'GET' | 'POST' = 'GET', data?: any, config: ApiConfig = {}) => {
const endpoint = RootStore.Get(BlinkoSnapStore).settings.value?.blinkoEndpoint
const token = RootStore.Get(BlinkoSnapStore).settings.value?.blinkoToken
if (!endpoint || !token) {
return null
}
const _URL = new URL(`${endpoint?.endsWith('/') ? endpoint : endpoint + '/'}api${url}`)

const headers: Record<string, string> = {
Expand Down
14 changes: 9 additions & 5 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ export const Home = observer(() => {
const blinkoSnap = RootStore.Get(BlinkoSnapStore);
const blinko = RootStore.Get(BlinkoStore);
useEffect(() => {
blinkoSnap.settings.call().then(res => {
if (!res.blinkoEndpoint || !res.blinkoToken) {
RootStore.Get(BaseStore).navigate('settings')
}
});
try {
blinkoSnap.settings.call().then(res => {
if (res?.blinkoEndpoint || res?.blinkoToken) {
RootStore.Get(BaseStore).navigate('settings')
}
});
} catch (err) {

}
}, []);

return (
Expand Down
17 changes: 10 additions & 7 deletions src/store/baseStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,14 @@ export class BaseStore implements Store {
}

async registerShortcut(shortcut: string) {
await register(shortcut, (event) => {
if (event.state === 'Pressed') {
this.toggleVisible()
}
})
try {
await register(shortcut, (event) => {
if (event.state === 'Pressed') {
this.toggleVisible()
}
})
} catch (error) {
}
}

async initTheme() {
Expand All @@ -102,7 +105,7 @@ export class BaseStore implements Store {
this.navigate('settings');
await setSetting('isFirstLoaded', 'true');
}
if(settings?.language){
if (settings?.language) {
i18next.changeLanguage(settings.language)
}
if (settings?.shortcut) {
Expand All @@ -113,7 +116,7 @@ export class BaseStore implements Store {
RootStore.Get(BlinkoStore).loadAllData()
} catch (error) {
console.error('Application initialization failed:', error);
throw error;
// throw error;
}
}
}
22 changes: 13 additions & 9 deletions src/store/blinkoStore.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,19 @@ export class BlinkoStore implements Store {
})

loadAllData() {
this.tagList.call()
const blinkoSnap = RootStore.Get(BlinkoSnapStore)
this.config.call().then(async res => {
await blinkoSnap.settings.call()
if(res?.data?.language != blinkoSnap.settings.value?.language){
setSetting('language', res?.data?.language)
i18next.changeLanguage(res?.data?.language)
}
})
try {
// this.tagList.call()
const blinkoSnap = RootStore.Get(BlinkoSnapStore)
this.config.call().then(async res => {
await blinkoSnap.settings.call()
if (res?.data?.language != blinkoSnap.settings.value?.language) {
setSetting('language', res?.data?.language)
i18next.changeLanguage(res?.data?.language)
}
})
} catch (error) {

}
}

constructor() {
Expand Down

0 comments on commit 0facbe7

Please sign in to comment.