tachybase_todo/packages/core/sdk/src/getSubAppName.ts
chenos b359f9eac6
feat: supports subdirectory deployment (#3731)
* feat: supports subdirectory deployment

* feat: auto publicPath

* fix: buildIndexHtml

* fix: format

* fix: regexp

* fix: test error

* fix: nocobase.conf

* fix: path

* fix: nocobase.conf

* fix: bugs

* fix: resourcer prefix

* fix: cas
2024-03-16 20:01:34 +08:00

12 lines
322 B
TypeScript

const getSubAppName = (publicPath = '/') => {
const prefix = `${publicPath}apps/`;
if (!window.location.pathname.startsWith(prefix)) {
return;
}
const pathname = window.location.pathname.substring(prefix.length);
const args = pathname.split('/', 1);
return args[0] || '';
};
export default getSubAppName;