chore(client): tweak user-info routing

This commit is contained in:
syuilo 2022-07-16 16:52:12 +09:00
parent 274bfc965f
commit e9fd064624
3 changed files with 5 additions and 9 deletions

View File

@ -155,7 +155,7 @@ const age = $computed(() => {
});
function menu(ev) {
os.popupMenu(getUserMenu(props.user), ev.currentTarget ?? ev.target);
os.popupMenu(getUserMenu(props.user, router), ev.currentTarget ?? ev.target);
}
function parallaxLoop() {

View File

@ -23,7 +23,6 @@ import calcAge from 's-age';
import * as Acct from 'misskey-js/built/acct';
import * as misskey from 'misskey-js';
import { getScrollPosition } from '@/scripts/scroll';
import { getUserMenu } from '@/scripts/get-user-menu';
import number from '@/filters/number';
import { userPage, acct as getAcct } from '@/filters/user';
import * as os from '@/os';
@ -65,10 +64,6 @@ watch(() => props.acct, fetchUser, {
immediate: true,
});
function menu(ev) {
os.popupMenu(getUserMenu(user), ev.currentTarget ?? ev.target);
}
const headerActions = $computed(() => []);
const headerTabs = $computed(() => user ? [{

View File

@ -7,8 +7,9 @@ import * as os from '@/os';
import { userActions } from '@/store';
import { $i, iAmModerator } from '@/account';
import { mainRouter } from '@/router';
import { Router } from '@/nirax';
export function getUserMenu(user) {
export function getUserMenu(user, router: Router = mainRouter) {
const meId = $i ? $i.id : null;
async function pushList() {
@ -161,7 +162,7 @@ export function getUserMenu(user) {
icon: 'fas fa-info-circle',
text: i18n.ts.info,
action: () => {
os.pageWindow(`/user-info/${user.id}`);
router.push(`/user-info/${user.id}`);
},
}, {
icon: 'fas fa-envelope',
@ -227,7 +228,7 @@ export function getUserMenu(user) {
icon: 'fas fa-pencil-alt',
text: i18n.ts.editProfile,
action: () => {
mainRouter.push('/settings/profile');
router.push('/settings/profile');
},
}]);
}