Skip to content

Commit dea0f44

Browse files
committed
replace redux store with nest config in owners.resolver.ts
1 parent 4d8624a commit dea0f44

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

api/src/unraid-api/graph/resolvers/owner/owner.resolver.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,28 @@ import { Query, Resolver, Subscription } from '@nestjs/graphql';
33
import { Resource } from '@unraid/shared/graphql.model.js';
44

55
import { createSubscription, PUBSUB_CHANNEL } from '@app/core/pubsub.js';
6-
import { getters } from '@app/store/index.js';
76
import {
87
AuthActionVerb,
98
AuthPossession,
109
UsePermissions,
1110
} from '@app/unraid-api/graph/directives/use-permissions.directive.js';
1211
import { Owner } from '@app/unraid-api/graph/resolvers/owner/owner.model.js';
12+
import { ConfigService } from '@nestjs/config';
1313

14+
// Question: should we move this into the connect plugin, or should this always be available?
1415
@Resolver(() => Owner)
1516
export class OwnerResolver {
17+
constructor(private readonly configService: ConfigService) {}
1618
@Query(() => Owner)
1719
@UsePermissions({
1820
action: AuthActionVerb.READ,
1921
resource: Resource.OWNER,
2022
possession: AuthPossession.ANY,
2123
})
2224
public async owner() {
23-
const { remote } = getters.config();
25+
const config = this.configService.get('connect.config');
2426

25-
if (!remote.username) {
27+
if (!config?.username) {
2628
return {
2729
username: 'root',
2830
avatar: '',
@@ -31,8 +33,8 @@ export class OwnerResolver {
3133
}
3234

3335
return {
34-
username: remote.username,
35-
avatar: remote.avatar,
36+
username: config.username,
37+
avatar: config.avatar,
3638
};
3739
}
3840

0 commit comments

Comments
 (0)