# Accessing store values in service

**URL:** <https://discourse.aurelia.io/t/accessing-store-values-in-service/5536>\
**Category:** vNext\
**Created:** [September 17, 2024, 4:13pm UTC](https://discourse.aurelia.io/t/accessing-store-values-in-service/5536 "2024-09-17T16:13:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nnnn](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/nnnn/32/2465_2.png) [@nnnn](https://discourse.aurelia.io/u/nnnn)\
**Post date:** [September 17, 2024, 4:13pm UTC](https://discourse.aurelia.io/t/accessing-store-values-in-service/5536/1 "2024-09-17T16:13:39Z")

</div>

I am using @fromState to get values in my service from store similar to this, but it is just the undefined or default value:

```auto
import { DI, IEventAggregator, resolve } from 'aurelia';
import { IRouter, IRouteableComponent } from '@aurelia/router';
import { fromState, IStore } from '@aurelia/state';
import { State } from './state.types';

export class Search implements IRouteableComponent {
    readonly ea: IEventAggregator = resolve(IEventAggregator);
    private router: IRouter = resolve(IRouter);

    @fromState<State>(state => {
        return state.query;
    })
    query: string;

    constructor(@IStore readonly store: IStore<{}, { type: string; value: string }>) {
        this.store = store;
    }

    method() {
       console.log('query in store', this.query)
    }
}

export const ISearch = DI.createInterface<ISearch>('ISearch', x => x.singleton(Search));

// Export type equal to the class to create an interface
export type ISearch = Search;

```

---

<div class="post-metadata">

**Author:** ![bigopon](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/bigopon/32/18_2.png) [@bigopon](https://discourse.aurelia.io/u/bigopon)\
**Post date:** [September 20, 2024, 4:34am UTC](https://discourse.aurelia.io/t/accessing-store-values-in-service/5536/2 "2024-09-20T04:34:29Z")

</div>

Can you create a repro? This seems like a basic scenario that should just work. You can use this stackblitz as the base for the repro [Au - Vite](https://stackblitz.com/edit/au2-conventions-tvyh8c?file=src%2Fmy-app.html)
