togglepopupRegionErrorModal()}
+ size="xs"
+ autoclose
+ outsideclose
+ >
+
+
+
+ この動画はあなたの地域では利用出来ません。
+
+
+
+
+{/if}
diff --git a/src/lib/store.ts b/src/lib/store.ts
index 51acfc5..85a90c6 100644
--- a/src/lib/store.ts
+++ b/src/lib/store.ts
@@ -3,6 +3,7 @@ import { writable } from 'svelte/store';
export const isLoading = writable(false);
export const popupFetchErrorModal = writable(false);
export const popupUrlErrorModal = writable(false);
+export const popupRegionErrorModal = writable(false);
export const toggleLoadingState = () => {
isLoading.update((value) => !value);
@@ -15,3 +16,7 @@ export const togglepopupFetchModal = () => {
export const togglepopupUrlErrorModal = () => {
popupUrlErrorModal.update((value) => !value);
};
+
+export const togglepopupRegionErrorModal = () => {
+ popupRegionErrorModal.update((value) => !value);
+}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index bc861cb..e82f9e3 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -11,7 +11,7 @@
Card
} from 'flowbite-svelte';
import { VideoSolid, FileMusicSolid, SearchOutline } from 'flowbite-svelte-icons';
- import { toggleLoadingState, togglepopupUrlErrorModal, togglepopupFetchModal } from '$lib/store';
+ import { toggleLoadingState, togglepopupUrlErrorModal, togglepopupFetchModal,togglepopupRegionErrorModal } from '$lib/store';
import { parseVideoUrl } from '$lib/parseURL';
import type { VideoInfo, PlaylistInfo, SearchInfo } from '$lib/types/index';
import Header from 'components/Header.svelte';
@@ -91,7 +91,8 @@
});
toggleLoadingState();
if (response.status !== 200) {
- togglepopupFetchModal();
+ let json = await response.json();
+ json.errorobj.info.error_type === "UNPLAYABLE" ? togglepopupRegionErrorModal() : togglepopupFetchModal();
return console.error(response.status, response);
}