mirror of
https://github.com/SrIzan10/hc-site.git
synced 2026-05-01 10:45:23 +00:00
as requested by @zachlatta in #hq in Slack, this deleted donate.js aka the page, and adding a redirect logic on middleware, also changed from any mdx file if there was any to the new link
23 lines
638 B
JavaScript
23 lines
638 B
JavaScript
import { NextResponse } from 'next/server'
|
|
import country from 'country-list-js'
|
|
const partners = ['gb_help_desk']
|
|
|
|
export function middleware(request) {
|
|
if (request.nextUrl.pathname.startsWith('/slack')) {
|
|
let continent = country.findByIso2(request.geo.country || 'AU').continent
|
|
if (continent === 'Oceania') {
|
|
continent = 'Australia'
|
|
}
|
|
const response = NextResponse.next()
|
|
response.cookies.set('continent', continent || '')
|
|
return response
|
|
}
|
|
|
|
if (request.nextUrl.pathname === '/donate/') {
|
|
return NextResponse.redirect('https://hackclub.com/philanthropy/');
|
|
}
|
|
|
|
return NextResponse.next();
|
|
|
|
}
|