チュートリアル完了後にアカウントのキャッシュが更新されない問題を修正
This commit is contained in:
parent
79812e4ccb
commit
63b7795007
|
@ -129,11 +129,15 @@ export async function common(createVue: () => App<Element>) {
|
||||||
!location.pathname.startsWith('/onboarding') &&
|
!location.pathname.startsWith('/onboarding') &&
|
||||||
!location.pathname.startsWith('/signup-complete')
|
!location.pathname.startsWith('/signup-complete')
|
||||||
) {
|
) {
|
||||||
|
await refreshAccount();
|
||||||
|
|
||||||
|
if ($i && !$i.achievements.map((v) => v.name).includes('tutorialCompleted')) {
|
||||||
const param = new URLSearchParams();
|
const param = new URLSearchParams();
|
||||||
param.set('redirected_from', location.pathname + location.search + location.hash);
|
param.set('redirected_from', location.pathname + location.search + location.hash);
|
||||||
location.replace('/onboarding?' + param.toString());
|
location.replace('/onboarding?' + param.toString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const fetchInstanceMetaPromise = fetchInstance();
|
const fetchInstanceMetaPromise = fetchInstance();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ import FormSlot from '@/components/form/slot.vue';
|
||||||
import MkInfo from '@/components/MkInfo.vue';
|
import MkInfo from '@/components/MkInfo.vue';
|
||||||
import { selectFile } from '@/scripts/select-file.js';
|
import { selectFile } from '@/scripts/select-file.js';
|
||||||
import * as os from '@/os.js';
|
import * as os from '@/os.js';
|
||||||
import { signinRequired } from '@/account.js';
|
import { signinRequired, updateAccount } from '@/account.js';
|
||||||
import type { TutorialPageCommonExpose } from '@/components/MkTutorial.vue';
|
import type { TutorialPageCommonExpose } from '@/components/MkTutorial.vue';
|
||||||
|
|
||||||
const $i = signinRequired();
|
const $i = signinRequired();
|
||||||
|
@ -53,6 +53,7 @@ watch(name, () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
name: name.value || null,
|
name: name.value || null,
|
||||||
});
|
});
|
||||||
|
updateAccount({ name: name.value });
|
||||||
});
|
});
|
||||||
|
|
||||||
watch(description, () => {
|
watch(description, () => {
|
||||||
|
@ -61,6 +62,7 @@ watch(description, () => {
|
||||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||||
description: description.value || null,
|
description: description.value || null,
|
||||||
});
|
});
|
||||||
|
updateAccount({ description: description.value });
|
||||||
});
|
});
|
||||||
|
|
||||||
function setAvatar(ev: MouseEvent) {
|
function setAvatar(ev: MouseEvent) {
|
||||||
|
@ -83,8 +85,7 @@ function setAvatar(ev: MouseEvent) {
|
||||||
const i = await os.apiWithDialog('i/update', {
|
const i = await os.apiWithDialog('i/update', {
|
||||||
avatarId: originalOrCropped.id,
|
avatarId: originalOrCropped.id,
|
||||||
});
|
});
|
||||||
$i.avatarId = i.avatarId;
|
updateAccount({ avatarId: i.avatarId, avatarUrl: i.avatarUrl });
|
||||||
$i.avatarUrl = i.avatarUrl;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||||
import { $i } from '@/account.js';
|
import { $i, refreshAccount } from '@/account.js';
|
||||||
|
|
||||||
export const ACHIEVEMENT_TYPES = [
|
export const ACHIEVEMENT_TYPES = [
|
||||||
'notes1',
|
'notes1',
|
||||||
|
@ -500,6 +500,10 @@ export async function claimAchievement(type: typeof ACHIEVEMENT_TYPES[number]) {
|
||||||
await new Promise(resolve => setTimeout(resolve, (claimingQueue.size - 1) * 500));
|
await new Promise(resolve => setTimeout(resolve, (claimingQueue.size - 1) * 500));
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
claimingQueue.delete(type);
|
claimingQueue.delete(type);
|
||||||
|
|
||||||
|
if (claimingQueue.size === 0) {
|
||||||
|
refreshAccount();
|
||||||
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
misskeyApi('i/claim-achievement', { name: type });
|
misskeyApi('i/claim-achievement', { name: type });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue