Commit 0073be9b authored by Filipa Lacerda's avatar Filipa Lacerda

Adds `.json` to the end of pipelines endpoint

When the job page is rendered we fetch the pipeline
endpoint to render the stages in the sidebar.
Without `.json` the response is cached, and when the
user goes back to the pipeline's page it renders the
json output instead of the Vue app
parent c230b5d1
...@@ -139,7 +139,7 @@ export const fetchStages = ({ state, dispatch }) => { ...@@ -139,7 +139,7 @@ export const fetchStages = ({ state, dispatch }) => {
dispatch('requestStages'); dispatch('requestStages');
axios axios
.get(state.job.pipeline.path) .get(`${state.job.pipeline.path}.json`)
.then(({ data }) => { .then(({ data }) => {
dispatch('receiveStagesSuccess', data.details.stages); dispatch('receiveStagesSuccess', data.details.stages);
dispatch('fetchJobsForStage', data.details.stages[0]); dispatch('fetchJobsForStage', data.details.stages[0]);
......
---
title: Fix caching issue with pipelines URL
merge_request:
author:
type: fixed
...@@ -422,7 +422,7 @@ describe('Job State actions', () => { ...@@ -422,7 +422,7 @@ describe('Job State actions', () => {
beforeEach(() => { beforeEach(() => {
mockedState.job.pipeline = { mockedState.job.pipeline = {
path: `${TEST_HOST}/endpoint.json/stages`, path: `${TEST_HOST}/endpoint`,
}; };
mock = new MockAdapter(axios); mock = new MockAdapter(axios);
}); });
...@@ -434,7 +434,7 @@ describe('Job State actions', () => { ...@@ -434,7 +434,7 @@ describe('Job State actions', () => {
describe('success', () => { describe('success', () => {
it('dispatches requestStages and receiveStagesSuccess, fetchJobsForStage ', done => { it('dispatches requestStages and receiveStagesSuccess, fetchJobsForStage ', done => {
mock mock
.onGet(`${TEST_HOST}/endpoint.json/stages`) .onGet(`${TEST_HOST}/endpoint.json`)
.replyOnce(200, { details: { stages: [{ id: 121212, name: 'build' }] } }); .replyOnce(200, { details: { stages: [{ id: 121212, name: 'build' }] } });
testAction( testAction(
......
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