Referer Fix
This commit is contained in:
@@ -222,7 +222,13 @@ async function generate() {
|
||||
if (modern.value) {
|
||||
// Use API for modern names
|
||||
const url = `https://namegen.fernandovideira.com/v1/modern/${language.value}?gender=${gender.value}`;
|
||||
const response = await fetch(url);
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Referer: window.location.href,
|
||||
Origin: window.location.origin,
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
@@ -247,7 +253,13 @@ async function generate() {
|
||||
} else {
|
||||
// Use API for fantasy names
|
||||
const url = `https://namegen.fernandovideira.com/v1/fantasy/${race.value}-names?gender=${gender.value}`;
|
||||
const response = await fetch(url);
|
||||
const response = await fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
Referer: window.location.href,
|
||||
Origin: window.location.origin,
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
|
||||
Reference in New Issue
Block a user