Move utils to /shared
[oweals/peertube.git] / shared / utils / videos / video-history.ts
diff --git a/shared/utils/videos/video-history.ts b/shared/utils/videos/video-history.ts
new file mode 100644 (file)
index 0000000..7635478
--- /dev/null
@@ -0,0 +1,14 @@
+import { makePutBodyRequest } from '../requests/requests'
+
+function userWatchVideo (url: string, token: string, videoId: number | string, currentTime: number) {
+  const path = '/api/v1/videos/' + videoId + '/watching'
+  const fields = { currentTime }
+
+  return makePutBodyRequest({ url, path, token, fields, statusCodeExpected: 204 })
+}
+
+// ---------------------------------------------------------------------------
+
+export {
+  userWatchVideo
+}