fix broken stack overflow stories - mock stack overflow api
Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
@@ -20,10 +20,16 @@ import {
|
||||
StackOverflowQuestionsRequestParams,
|
||||
} from '../types';
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const stackOverflowApiRef = createApiRef<StackOverflowApi>({
|
||||
id: 'plugin.stackoverflow.service',
|
||||
});
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type StackOverflowApi = {
|
||||
listQuestions(options?: {
|
||||
requestParams: StackOverflowQuestionsRequestParams;
|
||||
|
||||
+21
@@ -21,6 +21,26 @@ import { ConfigReader } from '@backstage/config';
|
||||
import { Grid } from '@material-ui/core';
|
||||
import React, { ComponentType } from 'react';
|
||||
import { StackOverflowIcon } from '../../icons';
|
||||
import { stackOverflowApiRef } from '../../api';
|
||||
|
||||
const mockStackOverflowApi = {
|
||||
listQuestions: async () => [
|
||||
{
|
||||
title: 'Customizing Spotify backstage UI',
|
||||
link: 'stackoverflow.question/1',
|
||||
answer_count: 0,
|
||||
tags: ['backstage'],
|
||||
owner: { 'some owner': 'name' },
|
||||
},
|
||||
{
|
||||
title: 'Customizing Spotify backstage UI',
|
||||
link: 'stackoverflow.question/1',
|
||||
answer_count: 0,
|
||||
tags: ['backstage'],
|
||||
owner: { 'some owner': 'name' },
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default {
|
||||
title: 'Plugins/Home/Components/StackOverflow',
|
||||
@@ -39,6 +59,7 @@ export default {
|
||||
},
|
||||
}),
|
||||
],
|
||||
[stackOverflowApiRef, mockStackOverflowApi],
|
||||
]}
|
||||
>
|
||||
<Story />
|
||||
|
||||
@@ -30,3 +30,5 @@ export type {
|
||||
StackOverflowQuestionsContentProps,
|
||||
StackOverflowQuestionsRequestParams,
|
||||
} from './types';
|
||||
export { stackOverflowApiRef } from './api';
|
||||
export type { StackOverflowApi } from './api';
|
||||
|
||||
Reference in New Issue
Block a user