mobilizon/js/src/mixins/resource.ts
Thomas Citharel 4144e9ffd0
Introduce group basic federation, event new page and notifications
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2020-06-03 16:01:26 +02:00

18 lines
471 B
TypeScript

import { Component, Vue } from "vue-property-decorator";
import { IResource } from "@/types/resource";
@Component
export default class ResourceMixin extends Vue {
static resourcePath(resource: IResource): string {
const { path } = resource;
if (path && path[0] === "/") {
return path.slice(1);
}
return path || "";
}
static resourcePathArray(resource: IResource): string[] {
return ResourceMixin.resourcePath(resource).split("/");
}
}