Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/files_external/src/services/externalStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
*/
// eslint-disable-next-line n/no-extraneous-import
import type { AxiosResponse } from 'axios'
import type { OCSResponse } from '../../../files_sharing/src/services/SharingService'
import type { ContentsWithRoot } from '@nextcloud/files'
import type { OCSResponse } from '@nextcloud/typings/ocs'

import { Folder, Permission } from '@nextcloud/files'
import { generateOcsUrl, generateRemoteUrl, generateUrl } from '@nextcloud/router'
Expand Down Expand Up @@ -83,7 +83,7 @@ const entryToFolder = (ocsEntry: MountEntry): Folder => {
}

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)

return {
Expand Down
5 changes: 3 additions & 2 deletions apps/files_sharing/src/services/SharingService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
* 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 axios from '@nextcloud/axios'
import { Type } from '@nextcloud/sharing'
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 logger from './logger'

Expand Down
12 changes: 1 addition & 11 deletions apps/files_sharing/src/services/SharingService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
/* eslint-disable camelcase, n/no-extraneous-import */
import type { AxiosPromise } from 'axios'
import type { OCSResponse } from '@nextcloud/typings/ocs'

import { Folder, File, type ContentsWithRoot } from '@nextcloud/files'
import { generateOcsUrl, generateRemoteUrl } from '@nextcloud/router'
Expand All @@ -31,17 +32,6 @@ import logger from './logger'

export const rootPath = `/files/${getCurrentUser()?.uid}`

export type OCSResponse<T> = {
ocs: {
meta: {
status: string
statuscode: number
message: string
},
data: T[]
}
}

const headers = {
'Content-Type': 'application/json',
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/src/views/shares.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
*
*/
/* eslint-disable n/no-extraneous-import */
import type { OCSResponse } from '@nextcloud/typings/ocs'
import { expect } from '@jest/globals'
import { Folder, Navigation, View, getNavigation } from '@nextcloud/files'
import axios from '@nextcloud/axios'

import '../main'
import { type OCSResponse } from '../services/SharingService'
import registerSharingViews from './shares'

declare global {
Expand Down
2 changes: 0 additions & 2 deletions dist/1462-1462.js

This file was deleted.

3 changes: 3 additions & 0 deletions dist/1758-1758.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/1758-1758.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/2913-2913.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/1462-1462.js.map → dist/2913-2913.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dist/3747-3747.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/3747-3747.js.map

Large diffs are not rendered by default.

Loading
Loading