feat(layout): added drawer when user is in mobile
This commit is contained in:
		@@ -3,33 +3,35 @@ import Cookies from 'js-cookie';
 | 
			
		||||
 | 
			
		||||
export function getAPIUrl() {
 | 
			
		||||
	if (GITPOD_WORKSPACE_URL) {
 | 
			
		||||
		const { href } = new URL(GITPOD_WORKSPACE_URL)
 | 
			
		||||
		const newURL = href.replace('https://', 'https://3001-').replace(/\/$/, '')
 | 
			
		||||
		return newURL
 | 
			
		||||
		const { href } = new URL(GITPOD_WORKSPACE_URL);
 | 
			
		||||
		const newURL = href.replace('https://', 'https://3001-').replace(/\/$/, '');
 | 
			
		||||
		return newURL;
 | 
			
		||||
	}
 | 
			
		||||
	if (CODESANDBOX_HOST) {
 | 
			
		||||
		     return `https://${CODESANDBOX_HOST.replace(/\$PORT/,'3001')}`
 | 
			
		||||
		return `https://${CODESANDBOX_HOST.replace(/\$PORT/, '3001')}`;
 | 
			
		||||
	}
 | 
			
		||||
	return dev ? 'http://localhost:3001' : 'http://localhost:3000';
 | 
			
		||||
	return dev
 | 
			
		||||
		? 'https://kaname-png-coolify-vrgj9w6jq5x2xxxv-3001.githubpreview.dev'
 | 
			
		||||
		: 'https://kaname-png-coolify-vrgj9w6jq5x2xxxv-3000.githubpreview.dev';
 | 
			
		||||
}
 | 
			
		||||
export function getWebhookUrl(type: string) {
 | 
			
		||||
	if (GITPOD_WORKSPACE_URL) {
 | 
			
		||||
		const { href } = new URL(GITPOD_WORKSPACE_URL)
 | 
			
		||||
		const newURL = href.replace('https://', 'https://3001-').replace(/\/$/, '')
 | 
			
		||||
		const { href } = new URL(GITPOD_WORKSPACE_URL);
 | 
			
		||||
		const newURL = href.replace('https://', 'https://3001-').replace(/\/$/, '');
 | 
			
		||||
		if (type === 'github') {
 | 
			
		||||
			return `${newURL}/webhooks/github/events`
 | 
			
		||||
			return `${newURL}/webhooks/github/events`;
 | 
			
		||||
		}
 | 
			
		||||
		if (type === 'gitlab') {
 | 
			
		||||
			return `${newURL}/webhooks/gitlab/events`
 | 
			
		||||
			return `${newURL}/webhooks/gitlab/events`;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if (CODESANDBOX_HOST) {
 | 
			
		||||
		const newURL = `https://${CODESANDBOX_HOST.replace(/\$PORT/,'3001')}`
 | 
			
		||||
		const newURL = `https://${CODESANDBOX_HOST.replace(/\$PORT/, '3001')}`;
 | 
			
		||||
		if (type === 'github') {
 | 
			
		||||
			return `${newURL}/webhooks/github/events`
 | 
			
		||||
			return `${newURL}/webhooks/github/events`;
 | 
			
		||||
		}
 | 
			
		||||
		if (type === 'gitlab') {
 | 
			
		||||
			return `${newURL}/webhooks/gitlab/events`
 | 
			
		||||
			return `${newURL}/webhooks/gitlab/events`;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return `https://webhook.site/0e5beb2c-4e9b-40e2-a89e-32295e570c21/events`;
 | 
			
		||||
@@ -103,7 +105,11 @@ async function send({
 | 
			
		||||
		return {};
 | 
			
		||||
	}
 | 
			
		||||
	if (!response.ok) {
 | 
			
		||||
		if (response.status === 401 && !path.startsWith('https://api.github') && !path.includes('/v4/user')) {
 | 
			
		||||
		if (
 | 
			
		||||
			response.status === 401 &&
 | 
			
		||||
			!path.startsWith('https://api.github') &&
 | 
			
		||||
			!path.includes('/v4/user')
 | 
			
		||||
		) {
 | 
			
		||||
			Cookies.remove('token');
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user