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( ...@@ -41,26 +41,23 @@ export const fetchGenomeInfoAsyncActions = createAsyncAction(
'genome/fetch_genome_info_failure' 'genome/fetch_genome_info_failure'
)<undefined, GenomeInfoData, Error>(); )<undefined, GenomeInfoData, Error>();
export const fetchGenomeData = ( export const fetchGenomeData =
genomeId: string (genomeId: string): ThunkAction<void, any, null, Action<string>> =>
): ThunkAction<void, any, null, Action<string>> => async (dispatch) => { async (dispatch) => {
await Promise.all([ await Promise.all([
dispatch(fetchGenomeInfo(genomeId)), dispatch(fetchGenomeInfo(genomeId)),
dispatch(fetchGenomeTrackCategories(genomeId)), dispatch(fetchGenomeTrackCategories(genomeId)),
dispatch(fetchGenomeKaryotype(genomeId)) dispatch(fetchGenomeKaryotype(genomeId))
]); ]);
dispatch(ensureSpeciesIsCommitted(genomeId)); dispatch(ensureSpeciesIsCommitted(genomeId));
dispatch(fetchExampleEnsObjects(genomeId)); dispatch(fetchExampleEnsObjects(genomeId));
}; };
export const fetchGenomeInfo: ActionCreator<ThunkAction< export const fetchGenomeInfo: ActionCreator<
void, ThunkAction<void, any, null, Action<string>>
any, > = (genomeId: string) => async (dispatch, getState: () => RootState) => {
null,
Action<string>
>> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
const state = getState(); const state = getState();
const genomeInfo = getGenomeInfoById(state, genomeId); const genomeInfo = getGenomeInfoById(state, genomeId);
if (genomeInfo) { if (genomeInfo) {
...@@ -87,16 +84,12 @@ export const fetchGenomeTrackCategoriesAsyncActions = createAsyncAction( ...@@ -87,16 +84,12 @@ export const fetchGenomeTrackCategoriesAsyncActions = createAsyncAction(
'genome/fetch_genome_track_categories_failure' 'genome/fetch_genome_track_categories_failure'
)<string, GenomeTrackCategories, Error>(); )<string, GenomeTrackCategories, Error>();
export const fetchGenomeTrackCategories: ActionCreator<ThunkAction< export const fetchGenomeTrackCategories: ActionCreator<
void, ThunkAction<void, any, null, Action<string>>
any, > = (genomeId: string) => async (dispatch, getState: () => RootState) => {
null,
Action<string>
>> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
try { try {
const currentGenomeTrackCategories: GenomeTrackCategories = getGenomeTrackCategories( const currentGenomeTrackCategories: GenomeTrackCategories =
getState() getGenomeTrackCategories(getState());
);
if (currentGenomeTrackCategories[genomeId]) { if (currentGenomeTrackCategories[genomeId]) {
return; return;
...@@ -108,10 +101,10 @@ export const fetchGenomeTrackCategories: ActionCreator<ThunkAction< ...@@ -108,10 +101,10 @@ export const fetchGenomeTrackCategories: ActionCreator<ThunkAction<
dispatch(fetchGenomeTrackCategoriesAsyncActions.request(genomeId)); 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); const response = await apiService.fetch(url);
updatedGenomeTrackCategories[genomeId] = response.track_categories;
updatedGenomeTrackCategories[genomeId] = response.track_categories;
dispatch( dispatch(
fetchGenomeTrackCategoriesAsyncActions.success( fetchGenomeTrackCategoriesAsyncActions.success(
updatedGenomeTrackCategories updatedGenomeTrackCategories
...@@ -128,16 +121,12 @@ export const fetchGenomeKaryotypeAsyncActions = createAsyncAction( ...@@ -128,16 +121,12 @@ export const fetchGenomeKaryotypeAsyncActions = createAsyncAction(
'genome/fetch_genome_karyotype_failure' 'genome/fetch_genome_karyotype_failure'
)<string, any, Error>(); )<string, any, Error>();
export const fetchGenomeKaryotype: ActionCreator<ThunkAction< export const fetchGenomeKaryotype: ActionCreator<
void, ThunkAction<void, any, null, Action<string>>
any, > = (genomeId: string) => async (dispatch, getState: () => RootState) => {
null,
Action<string>
>> = (genomeId: string) => async (dispatch, getState: () => RootState) => {
try { try {
const currentGenomeKaryotype: const currentGenomeKaryotype: GenomeKaryotypeItem[] | null =
| GenomeKaryotypeItem[] getGenomeKaryotype(getState());
| null = getGenomeKaryotype(getState());
if (currentGenomeKaryotype) { if (currentGenomeKaryotype) {
return; 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