The URL is duplicated.

export default function ManageList() {
const { onFinish } = useForm<HttpError>({
resource: 'manage',
action: 'create',
});

const [membership, setMembership] = useState<ICustomerGroups[]>([]);
const [membershipDetail, setMembershipDetail] =
useState<ICustomerGroupDetailValues>({
group_no: 0,
group_name: '',
term: {} as TermValues,
first_event: 0,
first_event_status: '',
});

useEffect(() => {
const fetchData = async () => {
try {
const membership = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/manage`,
{
headers: {
'Content-Type': 'application/json',
'ngrok-skip-browser-warning': '69420',
},
},
);
const detailData = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/manage/detail`,
{
headers: {
'Content-Type': 'application/json',
'ngrok-skip-browser-warning': '69420',
},
},
);
export default function ManageList() {
const { onFinish } = useForm<HttpError>({
resource: 'manage',
action: 'create',
});

const [membership, setMembership] = useState<ICustomerGroups[]>([]);
const [membershipDetail, setMembershipDetail] =
useState<ICustomerGroupDetailValues>({
group_no: 0,
group_name: '',
term: {} as TermValues,
first_event: 0,
first_event_status: '',
});

useEffect(() => {
const fetchData = async () => {
try {
const membership = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/manage`,
{
headers: {
'Content-Type': 'application/json',
'ngrok-skip-browser-warning': '69420',
},
},
);
const detailData = await fetch(
`${process.env.NEXT_PUBLIC_API_URL}/manage/detail`,
{
headers: {
'Content-Type': 'application/json',
'ngrok-skip-browser-warning': '69420',
},
},
);
localhost is fine. But live development is duplication url. https://alpha-admin.com/alpha-api.com/alpha-api.com/order?_end=10&_start=0
2 Replies
kapa.ai
kapa.ai5mo ago
Hi @florent. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- It looks like you're experiencing an issue with duplicated URLs in your live development environment. This is a known issue that can occur in development environments, as mentioned in the GitHub Issue #4603 (https://github.com/refinedev/refine/issues/4603). Here's a relevant comment from the issue:
Comment by MEMBER (1 upvote, 0 downvotes): Hello @Mikilll94, welcome back! Does that happens on production environment? On development environment, it&#x27;s expected, please see the related FAQ here: https://refine.dev/docs/faq/#why-are-api-calls-triggering-twice
To address this issue, you can refer to the FAQ section mentioned in the comment: Why are API calls triggering twice? (https://refine.dev/docs/faq/#why-are-api-calls-triggering-twice). If the problem persists in your production environment, you might need to investigate further into how the URLs are being constructed and ensure that there are no misconfigurations in your environment variables or API endpoint settings. For now, you can check the following: 1. Ensure that NEXT_PUBLIC_API_URL is correctly set in your environment variables. 2. Verify that there are no additional configurations or middleware that might be altering the URL. If you need more detailed assistance, feel free to provide additional context or check the refine documentation and community discussions for more insights. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5mo ago
<@1184365192482652173> kapa.ai is still learning and improving, please let us know how it did by reacting below