Browse Source

Merge pull request #2932 from nocodb/fix/use-api-reject

fix(gui-v2): use promise reject when returning api error
pull/2933/head
navi 2 years ago committed by GitHub
parent
commit
f4706f8a5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      packages/nc-gui-v2/composables/useApi/index.ts
  2. 2
      packages/nc-gui-v2/plugins/state.ts

6
packages/nc-gui-v2/composables/useApi/index.ts

@ -114,7 +114,7 @@ export function useApi<Data = any, RequestConfig = any>({
onRequestFinish() onRequestFinish()
return requestError return Promise.reject(requestError)
}, },
) )
@ -125,7 +125,7 @@ export function useApi<Data = any, RequestConfig = any>({
onRequestFinish() onRequestFinish()
return apiResponse return Promise.resolve(apiResponse)
}, },
(apiError) => { (apiError) => {
errorHook.trigger(apiError) errorHook.trigger(apiError)
@ -133,7 +133,7 @@ export function useApi<Data = any, RequestConfig = any>({
onRequestFinish() onRequestFinish()
return apiError return Promise.reject(apiError)
}, },
) )

2
packages/nc-gui-v2/plugins/state.ts

@ -3,7 +3,7 @@ import { defineNuxtPlugin } from '#app'
import { useBreakpoints, useDark, useGlobal, watch } from '#imports' import { useBreakpoints, useDark, useGlobal, watch } from '#imports'
/** /**
* Injects global state into nuxt app. * Initialize global state and watches for changes
* *
* @example * @example
* ```js * ```js

Loading…
Cancel
Save