diff --git a/src/api/createRoom.ts b/src/api/createRoom.ts
index 8af1542..eaa5f4f 100644
--- a/src/api/createRoom.ts
+++ b/src/api/createRoom.ts
@@ -1,5 +1,18 @@
import api from '@/api/index';
-export default (magnet:String) => api.post('/room', {
- magnet,
-}).then((response) => response.data);
+export default (movie: String | File) => {
+ if (typeof movie === 'string') {
+ return api.post('/roomMagnet', {
+ magnet: movie,
+ }).then((response) => response.data);
+ }
+
+ const formData = new FormData();
+ formData.append('file', movie as Blob);
+
+ return api.post('/roomFile', formData, {
+ headers: {
+ 'Content-Type': 'multipart/form-data',
+ },
+ }).then((response) => response.data);
+};
diff --git a/src/components/Spinner.vue b/src/components/Spinner.vue
new file mode 100644
index 0000000..c305bc6
--- /dev/null
+++ b/src/components/Spinner.vue
@@ -0,0 +1,39 @@
+
+
+
+
+
diff --git a/src/interfaces.ts b/src/interfaces.ts
index f0270e6..c7fbcc9 100644
--- a/src/interfaces.ts
+++ b/src/interfaces.ts
@@ -1,6 +1,6 @@
export interface Room {
id: string;
- magnet: string;
+ magnet?: string;
createdAt: Date;
movie?: string;
filename?: string;
diff --git a/src/scss/style.scss b/src/scss/style.scss
index 21080eb..79437ee 100644
--- a/src/scss/style.scss
+++ b/src/scss/style.scss
@@ -12,13 +12,13 @@ html, body {
height: 100%;
}
-button, input[type="text"], textarea {
+button, input[type="text"], input[type="file"], textarea {
padding: 8px 12px;
background: none;
border: 1px solid black;
}
-button, a {
+button, a, input[type="file"] {
cursor: pointer;
}
@@ -28,4 +28,14 @@ h1 {
h2 {
font-size: 24px;
+}
+
+.secondary {
+ color: #818181;
+}
+
+::file-selector-button {
+ background: none;
+ border: 1px solid black;
+ font-family: 'EB Garamond', serif;
}
\ No newline at end of file
diff --git a/src/views/Home/Index.vue b/src/views/Home/Index.vue
index afcfd80..3f1d62c 100644
--- a/src/views/Home/Index.vue
+++ b/src/views/Home/Index.vue
@@ -1,16 +1,29 @@
@@ -19,21 +32,40 @@
@@ -43,7 +75,26 @@ form {
margin-bottom: 32px;
> * {
- margin: 0 8px;
+ display: block;
+ margin: 8px 0;
+ width: 100%;
+ }
+
+ .submit {
+ position: relative;
+ display: flex;
+ align-items: center;
+
+ button {
+ width: 100%;
+ }
+
+ .spinner {
+ position: absolute;
+ right: -48px;
+ width: 32px;
+ height: 32px;
+ }
}
}
diff --git a/src/views/Room/Index.vue b/src/views/Room/Index.vue
index 74f35cf..efd9b1b 100644
--- a/src/views/Room/Index.vue
+++ b/src/views/Room/Index.vue
@@ -63,8 +63,10 @@ export default defineComponent({
clearInterval(this.positionInterval);
},
methods: {
- onDownloaded() {
- this.room.downloaded = true;
+ async onDownloaded() {
+ if (!this.room.downloaded) {
+ this.room = await getRoom(this.id);
+ }
this.$nextTick(() => {
const element = this.$refs.video as HTMLVideoElement;
this.positionInterval = setInterval(async () => {