Unverified Commit 59505cb3 authored by Jyothish's avatar Jyothish Committed by GitHub
Browse files

add new track api url (#560)

parent 1032b825
Pipeline #189252 passed with stages
in 4 minutes and 41 seconds
......@@ -41,26 +41,23 @@ export const fetchGenomeInfoAsyncActions = createAsyncAction(
'genome/fetch_genome_info_failure'
)<undefined, GenomeInfoData, Error>();
export const fetchGenomeData = (
genomeId: string
): ThunkAction<void, any, null, Action<string>> => async (dispatch) => {
await Promise.all([
dispatch(fetchGenomeInfo(genomeId)),
dispatch(fetchGenomeTrackCategories(genomeId)),
dispatch(fetchGenomeKaryotype(genomeId))
]);
dispatch(ensureSpeciesIsCommitted(genomeId));
dispatch(fetchExampleEnsObjects(genomeId));
};
export const fetchGenomeInfo: ActionCreator<ThunkAction<
void,
any,
null,
Action<string>
>> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
export const fetchGenomeData =
(genomeId: string): ThunkAction<void, any, null, Action<string>> =>
async (dispatch) => {
await Promise.all([
dispatch(fetchGenomeInfo(genomeId)),
dispatch(fetchGenomeTrackCategories(genomeId)),
dispatch(fetchGenomeKaryotype(genomeId))
]);
dispatch(ensureSpeciesIsCommitted(genomeId));
dispatch(fetchExampleEnsObjects(genomeId));
};
export const fetchGenomeInfo: ActionCreator<
ThunkAction<void, any, null, Action<string>>
> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
const state = getState();
const genomeInfo = getGenomeInfoById(state, genomeId);
if (genomeInfo) {
......@@ -87,16 +84,12 @@ export const fetchGenomeTrackCategoriesAsyncActions = createAsyncAction(
'genome/fetch_genome_track_categories_failure'
)<string, GenomeTrackCategories, Error>();
export const fetchGenomeTrackCategories: ActionCreator<ThunkAction<
void,
any,
null,
Action<string>
>> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
export const fetchGenomeTrackCategories: ActionCreator<
ThunkAction<void, any, null, Action<string>>
> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
try {
const currentGenomeTrackCategories: GenomeTrackCategories = getGenomeTrackCategories(
getState()
);
const currentGenomeTrackCategories: GenomeTrackCategories =
getGenomeTrackCategories(getState());
if (currentGenomeTrackCategories[genomeId]) {
return;
......@@ -108,10 +101,10 @@ export const fetchGenomeTrackCategories: ActionCreator<ThunkAction<
dispatch(fetchGenomeTrackCategoriesAsyncActions.request(genomeId));
const url = `/api/genomesearch/genome/track_categories?genome_id=${genomeId}`;
const url = `/api/tracks/track_categories/${genomeId}`;
const response = await apiService.fetch(url);
updatedGenomeTrackCategories[genomeId] = response.track_categories;
updatedGenomeTrackCategories[genomeId] = response.track_categories;
dispatch(
fetchGenomeTrackCategoriesAsyncActions.success(
updatedGenomeTrackCategories
......@@ -128,16 +121,12 @@ export const fetchGenomeKaryotypeAsyncActions = createAsyncAction(
'genome/fetch_genome_karyotype_failure'
)<string, any, Error>();
export const fetchGenomeKaryotype: ActionCreator<ThunkAction<
void,
any,
null,
Action<string>
>> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
export const fetchGenomeKaryotype: ActionCreator<
ThunkAction<void, any, null, Action<string>>
> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
try {
const currentGenomeKaryotype:
| GenomeKaryotypeItem[]
| null = getGenomeKaryotype(getState());
const currentGenomeKaryotype: GenomeKaryotypeItem[] | null =
getGenomeKaryotype(getState());
if (currentGenomeKaryotype) {
return;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment