mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
fix(FE): resolve merge conflict checkbox and constant
This commit is contained in:
@@ -10,6 +10,8 @@ export const sleep = (ms: number = 1000) =>
|
||||
new Promise((resolve) => setTimeout(resolve, ms));
|
||||
|
||||
export const formatDate = (date: moment.MomentInput, format?: string) => {
|
||||
if (!date) return '-';
|
||||
|
||||
return moment(date).format(format);
|
||||
};
|
||||
|
||||
@@ -127,3 +129,16 @@ export const convertRowSelectionObjToArr = (
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export const isPathActive = (pathname: string, link?: string) => {
|
||||
if (!link) return false;
|
||||
|
||||
const splittedPathname = pathname.split('/');
|
||||
const splittedLink = link.split('/');
|
||||
|
||||
const isActiveLinkValid = splittedLink.every((linkChunk, idx) => {
|
||||
return linkChunk === splittedPathname[idx];
|
||||
});
|
||||
|
||||
return pathname.startsWith(link) && isActiveLinkValid;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user