From db3142729b39bf990286abb510dc09ac3b3c727f Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Fri, 29 Jul 2022 22:27:27 +0200 Subject: [PATCH] feat(gui-v2): add `refreshToken` to global actions --- packages/nc-gui-v2/composables/useGlobal/actions.ts | 4 +++- packages/nc-gui-v2/composables/useGlobal/types.ts | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui-v2/composables/useGlobal/actions.ts b/packages/nc-gui-v2/composables/useGlobal/actions.ts index 108f6e1428..f0d8e8a7b9 100644 --- a/packages/nc-gui-v2/composables/useGlobal/actions.ts +++ b/packages/nc-gui-v2/composables/useGlobal/actions.ts @@ -2,7 +2,9 @@ import { notification } from 'ant-design-vue' import type { Actions, State } from './types' import { useNuxtApp } from '#imports' -export function useGlobalActions(state: State) { +export function useGlobalActions(state: State): Actions { + // todo replace with just `new Api()`? Would solve recursion issues + /** we have to use the globally injected api instance, otherwise we run into recursion as `useApi` calls `useGlobal` */ const { $api } = useNuxtApp() /** Sign out by deleting the token from localStorage */ diff --git a/packages/nc-gui-v2/composables/useGlobal/types.ts b/packages/nc-gui-v2/composables/useGlobal/types.ts index c989476338..4eb70c6a8a 100644 --- a/packages/nc-gui-v2/composables/useGlobal/types.ts +++ b/packages/nc-gui-v2/composables/useGlobal/types.ts @@ -29,6 +29,7 @@ export interface Getters { export interface Actions { signOut: () => void signIn: (token: string) => void + refreshToken: () => void } export type ReadonlyState = Readonly> & Omit