chore(files_sharing): use `OCSResponse` from `@nextcloud/typings`

Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This commit is contained in:
skjnldsv 2024-02-22 10:20:21 +01:00
parent f1c79cd264
commit 7b95811290
180 changed files with 2428 additions and 1560 deletions

View File

@ -21,8 +21,8 @@
*/ */
// eslint-disable-next-line n/no-extraneous-import // eslint-disable-next-line n/no-extraneous-import
import type { AxiosResponse } from 'axios' import type { AxiosResponse } from 'axios'
import type { OCSResponse } from '../../../files_sharing/src/services/SharingService'
import type { ContentsWithRoot } from '@nextcloud/files' import type { ContentsWithRoot } from '@nextcloud/files'
import type { OCSResponse } from '@nextcloud/typings/ocs'
import { Folder, Permission } from '@nextcloud/files' import { Folder, Permission } from '@nextcloud/files'
import { generateOcsUrl, generateRemoteUrl, generateUrl } from '@nextcloud/router' import { generateOcsUrl, generateRemoteUrl, generateUrl } from '@nextcloud/router'
@ -83,7 +83,7 @@ const entryToFolder = (ocsEntry: MountEntry): Folder => {
} }
export const getContents = async (): Promise<ContentsWithRoot> => { export const getContents = async (): Promise<ContentsWithRoot> => {
const response = await axios.get(generateOcsUrl('apps/files_external/api/v1/mounts')) as AxiosResponse<OCSResponse<MountEntry>> const response = await axios.get(generateOcsUrl('apps/files_external/api/v1/mounts')) as AxiosResponse<OCSResponse<MountEntry[]>>
const contents = response.data.ocs.data.map(entryToFolder) const contents = response.data.ocs.data.map(entryToFolder)
return { return {

View File

@ -19,12 +19,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
import type { OCSResponse } from '@nextcloud/typings/ocs'
import { expect } from '@jest/globals' import { expect } from '@jest/globals'
import axios from '@nextcloud/axios'
import { Type } from '@nextcloud/sharing' import { Type } from '@nextcloud/sharing'
import * as auth from '@nextcloud/auth' import * as auth from '@nextcloud/auth'
import axios from '@nextcloud/axios'
import { getContents, type OCSResponse } from './SharingService' import { getContents } from './SharingService'
import { File, Folder } from '@nextcloud/files' import { File, Folder } from '@nextcloud/files'
import logger from './logger' import logger from './logger'

View File

@ -21,6 +21,7 @@
*/ */
/* eslint-disable camelcase, n/no-extraneous-import */ /* eslint-disable camelcase, n/no-extraneous-import */
import type { AxiosPromise } from 'axios' import type { AxiosPromise } from 'axios'
import type { OCSResponse } from '@nextcloud/typings/ocs'
import { Folder, File, type ContentsWithRoot } from '@nextcloud/files' import { Folder, File, type ContentsWithRoot } from '@nextcloud/files'
import { generateOcsUrl, generateRemoteUrl } from '@nextcloud/router' import { generateOcsUrl, generateRemoteUrl } from '@nextcloud/router'
@ -31,17 +32,6 @@ import logger from './logger'
export const rootPath = `/files/${getCurrentUser()?.uid}` export const rootPath = `/files/${getCurrentUser()?.uid}`
export type OCSResponse<T> = {
ocs: {
meta: {
status: string
statuscode: number
message: string
},
data: T[]
}
}
const headers = { const headers = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} }

View File

@ -20,12 +20,12 @@
* *
*/ */
/* eslint-disable n/no-extraneous-import */ /* eslint-disable n/no-extraneous-import */
import type { OCSResponse } from '@nextcloud/typings/ocs'
import { expect } from '@jest/globals' import { expect } from '@jest/globals'
import { Folder, Navigation, View, getNavigation } from '@nextcloud/files' import { Folder, Navigation, View, getNavigation } from '@nextcloud/files'
import axios from '@nextcloud/axios' import axios from '@nextcloud/axios'
import '../main' import '../main'
import { type OCSResponse } from '../services/SharingService'
import registerSharingViews from './shares' import registerSharingViews from './shares'
declare global { declare global {

BIN
dist/1462-1462.js vendored

Binary file not shown.

BIN
dist/1758-1758.js vendored Normal file

Binary file not shown.

BIN
dist/1758-1758.js.map vendored Normal file

Binary file not shown.

BIN
dist/2913-2913.js vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
dist/3747-3747.js vendored Normal file

Binary file not shown.

BIN
dist/3747-3747.js.map vendored Normal file

Binary file not shown.

BIN
dist/4070-4070.js vendored

Binary file not shown.

BIN
dist/4070-4070.js.map vendored

Binary file not shown.

BIN
dist/430-430.js vendored

Binary file not shown.

BIN
dist/430-430.js.map vendored

Binary file not shown.

BIN
dist/4718-4718.js vendored Normal file

Binary file not shown.

BIN
dist/4718-4718.js.map vendored Normal file

Binary file not shown.

BIN
dist/5225-5225.js vendored Normal file

Binary file not shown.

BIN
dist/5225-5225.js.map vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/5662-5662.js vendored Normal file

Binary file not shown.

BIN
dist/5662-5662.js.map vendored Normal file

Binary file not shown.

BIN
dist/5935-5935.js vendored

Binary file not shown.

BIN
dist/5935-5935.js.map vendored

Binary file not shown.

BIN
dist/5951-5951.js vendored

Binary file not shown.

BIN
dist/5951-5951.js.map vendored

Binary file not shown.

BIN
dist/6826-6826.js vendored

Binary file not shown.

BIN
dist/6826-6826.js.map vendored

Binary file not shown.

BIN
dist/7057-7057.js vendored

Binary file not shown.

BIN
dist/7057-7057.js.map vendored

Binary file not shown.

BIN
dist/7462-7462.js vendored Normal file

Binary file not shown.

BIN
dist/7462-7462.js.map vendored Normal file

Binary file not shown.

BIN
dist/7816-7816.js vendored

Binary file not shown.

BIN
dist/7816-7816.js.map vendored

Binary file not shown.

BIN
dist/7883-7883.js vendored Normal file

Binary file not shown.

BIN
dist/7883-7883.js.map vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/comments-init.js vendored

Binary file not shown.

Binary file not shown.

BIN
dist/core-common.js vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/core-install.js vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/core-login.js vendored

Binary file not shown.

BIN
dist/core-login.js.map vendored

Binary file not shown.

BIN
dist/core-main.js vendored

Binary file not shown.

BIN
dist/core-main.js.map vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/core-profile.js vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/dashboard-main.js vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/files-init.js vendored

Binary file not shown.

Binary file not shown.

BIN
dist/files-init.js.map vendored

Binary file not shown.

BIN
dist/files-main.js vendored

Binary file not shown.

BIN
dist/files-main.js.map vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/files-sidebar.js vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More