mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-11 01:22:48 +00:00
UI done for video archiving
This commit is contained in:
14
client/app/services/archive.service.ts
Normal file
14
client/app/services/archive.service.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import * as _ from 'lodash';
|
||||
import { IVideoArchive } from '../model';
|
||||
import { axios } from './axios.service';
|
||||
|
||||
export class ArchiveService {
|
||||
public static async getVideoArchive(): Promise<IVideoArchive[]> {
|
||||
const data = (await axios.get('/api/video-archive')).data.data;
|
||||
return _.orderBy(data, 'created_at', ['desc']);
|
||||
}
|
||||
|
||||
public static postVideoArchive(data: any): Promise<any> {
|
||||
return axios.post('/api/video-archive', data);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,29 @@
|
||||
import ax from 'axios';
|
||||
import nprogress from 'nprogress';
|
||||
|
||||
nprogress.configure({ showSpinner: false });
|
||||
|
||||
export const axios = ax.create();
|
||||
|
||||
axios.interceptors.request.use(
|
||||
config => {
|
||||
nprogress.start();
|
||||
// Do something before request is sent
|
||||
return config;
|
||||
},
|
||||
function(error) {
|
||||
error => {
|
||||
// Do something with request error
|
||||
return Promise.reject(error);
|
||||
},
|
||||
);
|
||||
|
||||
axios.interceptors.response.use(
|
||||
config => {
|
||||
nprogress.done();
|
||||
return config;
|
||||
},
|
||||
error => {
|
||||
nprogress.done();
|
||||
return Promise.reject(error);
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user