aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/src')
-rw-r--r--apps/files/src/components/TemplatePreview.vue2
-rw-r--r--apps/files/src/utils/davUtils.js14
-rw-r--r--apps/files/src/utils/davUtils.ts23
3 files changed, 24 insertions, 15 deletions
diff --git a/apps/files/src/components/TemplatePreview.vue b/apps/files/src/components/TemplatePreview.vue
index 512a165989a..7737ebc030f 100644
--- a/apps/files/src/components/TemplatePreview.vue
+++ b/apps/files/src/components/TemplatePreview.vue
@@ -33,7 +33,7 @@
<script>
import { encodePath } from '@nextcloud/paths'
import { generateUrl } from '@nextcloud/router'
-import { getToken, isPublic } from '../utils/davUtils.js'
+import { getToken, isPublic } from '../utils/davUtils.ts'
// preview width generation
const previewWidth = 256
diff --git a/apps/files/src/utils/davUtils.js b/apps/files/src/utils/davUtils.js
deleted file mode 100644
index 8c28c25c044..00000000000
--- a/apps/files/src/utils/davUtils.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-import { getCurrentUser } from '@nextcloud/auth'
-
-export const isPublic = function() {
- return !getCurrentUser()
-}
-
-export const getToken = function() {
- return document.getElementById('sharingToken') && document.getElementById('sharingToken').value
-}
diff --git a/apps/files/src/utils/davUtils.ts b/apps/files/src/utils/davUtils.ts
new file mode 100644
index 00000000000..38137a04d16
--- /dev/null
+++ b/apps/files/src/utils/davUtils.ts
@@ -0,0 +1,23 @@
+/**
+ * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import { getCurrentUser } from '@nextcloud/auth'
+
+/**
+ * Check whether this is a public share
+ * @return {boolean} Whether this is a public share
+ */
+export function isPublic() {
+ return !getCurrentUser()
+}
+
+/**
+ * Get the sharing token
+ * @return {string|null} The sharing token
+ */
+export function getToken() {
+ const tokenElement = document.getElementById('sharingToken') as (HTMLInputElement | null)
+ return tokenElement?.value
+}