Skip to content

Commit

Permalink
🐛 Fix window is not defined, removed debug log
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDanniCraft committed Oct 30, 2024
1 parent b7b3e74 commit 4834656
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/app/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@ export default function Home() {
const [pendingFiles, setPendingFiles] = useState(null);
const [userPhrase, setUserPhrase] = useState('');
const [opened, { open, close }] = useDisclosure(false);
const [origin, setOrigin] = useState('');
const searchParams = useSearchParams();
const { SVG } = useQRCode();

const DEFAULT_DURATION = 2; // hours
const EXTEND_DURATION = 7; // days

useEffect(() => {
setOrigin(window.location.origin);
}, []);

const handleInputChange = useCallback(async (newCode) => {
setKeyError(false);

Expand Down Expand Up @@ -208,7 +213,7 @@ export default function Home() {
w="auto"
fit="contain"
src="/QuickDropIconText.svg"
onClick={() => window.location.href = window.location.origin}
onClick={() => window.location.href = origin}
style={{ cursor: 'pointer' }}
/>
</Center>
Expand Down Expand Up @@ -329,7 +334,7 @@ export default function Home() {
<Stack>
<Center>
<SVG
text={`${window.location.origin}?code=${downloadCode}`}
text={`${origin}?code=${downloadCode}`}
options={{
level: 'M',
margin: 3,
Expand All @@ -354,7 +359,7 @@ export default function Home() {
navigator.share({
title: t('share.shareTitle'),
text: t('share.shareText'),
url: `${window.location.origin}?code=${downloadCode}`,
url: `${origin}?code=${downloadCode}`,
}).catch((error) => {
console.error('Error sharing:', error);
});
Expand Down
1 change: 0 additions & 1 deletion src/i18n/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const timeZonesByLang = {

export default getRequestConfig(async () => {
const acceptLanguage = headers().get('accept-language') || 'en';
console.log(acceptLanguage);
let locale = acceptLanguage.split(',')[0].split('-')[0];

try {
Expand Down

0 comments on commit 4834656

Please sign in to comment.