mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 22:57:12 +01:00
Support basePath in all queries.
This commit is contained in:
parent
2508198a51
commit
5068ab12a9
11 changed files with 57 additions and 29 deletions
|
|
@ -1,4 +1,5 @@
|
|||
import { useState, useEffect } from 'react';
|
||||
import { useRouter } from 'next/router';
|
||||
import { get } from 'lib/web';
|
||||
import enUS from 'public/country/en-US.json';
|
||||
|
||||
|
|
@ -8,9 +9,10 @@ const countryNames = {
|
|||
|
||||
export default function useCountryNames(locale) {
|
||||
const [list, setList] = useState(countryNames[locale] || enUS);
|
||||
const { basePath } = useRouter();
|
||||
|
||||
async function loadData(locale) {
|
||||
const { ok, data } = await get(`/country/${locale}.json`);
|
||||
const { ok, data } = await get(`${basePath}/country/${locale}.json`);
|
||||
|
||||
if (ok) {
|
||||
countryNames[locale] = data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue