import { match } from 'path-to-regexp';

const path = '/admin/emails/:template';
const urlMatch = match(path, { decode: decodeURIComponent });

export default (pageContext) => {
	const matched = urlMatch(pageContext.urlPathname);

	if (matched) {
		return {
			routeParams: {
				template: matched.params.template,
			},
		};
	}

	return false;
};
