Skip to content

Commit

Permalink
fix: first visit & feat: set provider restore
Browse files Browse the repository at this point in the history
  • Loading branch information
NitroRCr committed Dec 29, 2024
1 parent 3d13b21 commit b8d3cba
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 2 additions & 3 deletions src/composables/first-visit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ import { db } from 'src/utils/db'
import { localData } from 'src/utils/local-data'
import { dialogOptions } from 'src/utils/values'
import { onMounted } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useRouter } from 'vue-router'

export function useFirstVisit() {
const $q = useQuasar()
const route = useRoute()
const router = useRouter()
onMounted(() => {
if (route.path === '/set-provider') {
if (location.pathname === '/set-provider') {
localData.visited = true
return
}
Expand Down
15 changes: 12 additions & 3 deletions src/pages/SetProvider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,19 @@ until(() => userPerfsStore.ready).toBeTruthy().then(() => {
if (!new Validator(ProviderSchema).validate(provider)) {
throw new Error('Invalid provider schema')
}
const bak = userPerfsStore.perfs.provider
userPerfsStore.perfs.provider = provider
$q.notify({
message: '已设置服务商',
color: 'positive'
message: `已设置服务商为:${provider.settings.baseURL}`,
color: 'positive',
actions: [{
label: '还原',
handler: () => {
userPerfsStore.perfs.provider = bak
},
color: 'white'
}],
timeout: 6000
})
} catch (e) {
console.error(e)
Expand All @@ -31,7 +40,7 @@ until(() => userPerfsStore.ready).toBeTruthy().then(() => {
color: 'negative'
})
} finally {
router.replace('/')
router.replace('/settings')
}
})
</script>
4 changes: 2 additions & 2 deletions src/version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "v1.2.2-beta",
"versionCode": 10202,
"version": "v1.2.3-beta",
"versionCode": 10203,
"forceUpdateFrom": 10199
}

0 comments on commit b8d3cba

Please sign in to comment.