Skip to content

Commit

Permalink
fix: use first UID when default UID not exists
Browse files Browse the repository at this point in the history
fix #272
  • Loading branch information
Tsuk1ko committed Jun 22, 2024
1 parent 9034ce8 commit a7ea065
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/store/skland.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ export const useSklandStore = defineStore('skland', () => {
const fetchSklandBinding = async () => {
if (uid.value) return;
const data = await fetchSkland('/api/v1/game/player/binding', cred.value, token.value);
const newUid = data.list
.find(({ appCode }) => appCode === 'arknights')
?.bindingList.find(({ isDefault }) => isDefault)?.uid;
if (!uid) throw new Error('UID not found.');
const app = data.list.find(({ appCode }) => appCode === 'arknights');
if (!app) throw new Error('Arknights app not found.');
const newUid = app.defaultUid || app.bindingList[0]?.uid;
if (!newUid) throw new Error('UID not found.');
uid.value = newUid;
};

Expand Down

0 comments on commit a7ea065

Please sign in to comment.