Skip to content

Commit

Permalink
Remove redundant Fetcher::setSignedIn
Browse files Browse the repository at this point in the history
  • Loading branch information
silverbackdan committed Sep 21, 2024
1 parent a61af6e commit 09952ce
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
6 changes: 0 additions & 6 deletions src/runtime/api/fetcher/fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { RouteLocationNormalizedLoaded } from 'vue-router'
import type { FetchResponse } from 'ofetch'
import type { ComputedRef } from 'vue'
import {
CwaResourceTypes,
getResourceTypeFromIri,
Expand Down Expand Up @@ -69,7 +68,6 @@ export default class Fetcher {
private fetchStatusManager: FetchStatusManager
private currentRoute: RouteLocationNormalizedLoaded
private resourcesStoreDefinition: ResourcesStore
private signedIn: undefined|ComputedRef<boolean>

constructor (
cwaFetch: CwaFetch,
Expand All @@ -83,10 +81,6 @@ export default class Fetcher {
this.resourcesStoreDefinition = resourcesStoreDefinition
}

public setSignedIn (signedIn: ComputedRef<boolean>) {
this.signedIn = signedIn
}

public async fetchRoute (route: RouteLocationNormalizedLoaded): Promise<CwaResource|undefined> {
if (route.meta.cwa === false) {
this.fetchStatusManager.clearPrimaryFetch()
Expand Down
3 changes: 1 addition & 2 deletions src/runtime/cwa.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ vi.mock('./storage/storage', () => {

vi.mock('./api/fetcher/fetcher', () => {
return {
default: vi.fn(() => ({ setSignedIn: vi.fn() }))
default: vi.fn(() => ({ }))
}
})

Expand Down Expand Up @@ -178,7 +178,6 @@ describe('Cwa class test', () => {
createCwa({ storeName })
const stores = Storage.mock.results[0].value.stores
expect(Fetcher).toBeCalledWith(CwaFetch.mock.results[0].value, FetchStatusManager.mock.results[0].value, { path }, stores.resources)
expect(Fetcher.mock.results[0].value.setSignedIn).toBeCalledWith(Auth.mock.results[0].value.signedIn)
})

test('Resources is initialised and accessible', () => {
Expand Down
1 change: 0 additions & 1 deletion src/runtime/cwa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export default class Cwa {
this.storage.stores.fetcher,
useCookie('cwa_auth', { sameSite: 'strict' })
)
this.fetcher.setSignedIn(this.auth.signedIn)
this.forms = new Forms(this.storage.stores.resources)
this.mercure.setFetcher(this.fetcher)
this.mercure.setRequestCount(this.resourcesManager.requestCount)
Expand Down

0 comments on commit 09952ce

Please sign in to comment.