Skip to content

Commit

Permalink
Merge pull request #43758 from nextcloud/fix/OCSResponse
Browse files Browse the repository at this point in the history
chore(files_sharing): use `OCSResponse` from `@nextcloud/typings`
  • Loading branch information
skjnldsv authored Feb 23, 2024
2 parents f1c79cd + eb672e8 commit fa773ec
Show file tree
Hide file tree
Showing 181 changed files with 2,719 additions and 1,799 deletions.
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

0 comments on commit fa773ec

Please sign in to comment.