fix:提交修复6个问题
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import type { PartnerMe } from '@dukang/shared-types';
|
||||
|
||||
export function isPrimaryAccount(account: PartnerMe | null | undefined): boolean {
|
||||
return account?.isPrimary !== false;
|
||||
}
|
||||
|
||||
export function isSubAccount(account: PartnerMe | null | undefined): boolean {
|
||||
return !!account && account.isPrimary === false;
|
||||
}
|
||||
|
||||
export function partnerHomePath(account: PartnerMe | null | undefined): string {
|
||||
return isSubAccount(account) ? '/stores/new' : '/';
|
||||
}
|
||||
|
||||
export const SUB_ACCOUNT_ALLOWED_PREFIXES = ['/stores', '/login'];
|
||||
|
||||
export function isSubAccountPath(pathname: string): boolean {
|
||||
if (pathname === '/login') return true;
|
||||
return SUB_ACCOUNT_ALLOWED_PREFIXES.some(
|
||||
(prefix) => prefix !== '/login' && (pathname === prefix || pathname.startsWith(`${prefix}/`)),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user