mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			733 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			733 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| export const getTogglePath = (projectId: string, featureToggleName: string) => {
 | |
|     return `/projects/${projectId}/features/${featureToggleName}`;
 | |
| };
 | |
| 
 | |
| export const getCreateTogglePath = (
 | |
|     projectId: string,
 | |
|     newPath: boolean = false,
 | |
|     query?: Record<string, string>
 | |
| ) => {
 | |
|     const path = `/projects/${projectId}/create-toggle`;
 | |
| 
 | |
|     let queryString;
 | |
|     if (query) {
 | |
|         queryString = Object.keys(query).reduce((acc, curr) => {
 | |
|             acc += `${curr}=${query[curr]}`;
 | |
|             return acc;
 | |
|         }, '');
 | |
|     }
 | |
| 
 | |
|     if (queryString) {
 | |
|         return `${path}?${queryString}`;
 | |
|     }
 | |
| 
 | |
|     return path;
 | |
| };
 | |
| 
 | |
| export const getProjectEditPath = (projectId: string) => {
 | |
|     return `/projects/${projectId}/edit`;
 | |
| };
 |