wip
This commit is contained in:
parent
ca4ac0f3b3
commit
bdffbd791f
|
@ -96,7 +96,6 @@ export async function removeAccount(idOrToken: Account['id']) {
|
||||||
|
|
||||||
function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Promise<Account> {
|
function fetchAccount(token: string, id?: string, forceShowDialog?: boolean): Promise<Account> {
|
||||||
return new Promise((done, fail) => {
|
return new Promise((done, fail) => {
|
||||||
// Fetch user
|
|
||||||
window.fetch(`${apiUrl}/i`, {
|
window.fetch(`${apiUrl}/i`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|
|
@ -28,6 +28,7 @@ import * as os from '@/os';
|
||||||
import MkModal from '@/components/MkModal.vue';
|
import MkModal from '@/components/MkModal.vue';
|
||||||
import MkButton from '@/components/MkButton.vue';
|
import MkButton from '@/components/MkButton.vue';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
import { $i, updateAccount } from '@/account';
|
||||||
|
|
||||||
const props = withDefaults(defineProps<{
|
const props = withDefaults(defineProps<{
|
||||||
announcement: misskey.entities.Announcement;
|
announcement: misskey.entities.Announcement;
|
||||||
|
@ -40,6 +41,9 @@ const modal = shallowRef<InstanceType<typeof MkModal>>();
|
||||||
function ok() {
|
function ok() {
|
||||||
modal.value.close();
|
modal.value.close();
|
||||||
os.api('i/read-announcement', { announcementId: props.announcement.id });
|
os.api('i/read-announcement', { announcementId: props.announcement.id });
|
||||||
|
updateAccount({
|
||||||
|
unreadAnnouncements: $i!.unreadAnnouncements.filter(a => a.id !== props.announcement.id),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBgClick() {
|
function onBgClick() {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import MkButton from '@/components/MkButton.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
import { $i } from '@/account';
|
import { $i, updateAccount } from '@/account';
|
||||||
|
|
||||||
const pagination = {
|
const pagination = {
|
||||||
endpoint: 'announcements' as const,
|
endpoint: 'announcements' as const,
|
||||||
|
@ -50,6 +50,9 @@ function read(id: string) {
|
||||||
return announcement;
|
return announcement;
|
||||||
});
|
});
|
||||||
os.api('i/read-announcement', { announcementId: id });
|
os.api('i/read-announcement', { announcementId: id });
|
||||||
|
updateAccount({
|
||||||
|
unreadAnnouncements: $i!.unreadAnnouncements.filter(a => a.id !== id),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerActions = $computed(() => []);
|
const headerActions = $computed(() => []);
|
||||||
|
|
Loading…
Reference in New Issue