mirror of
https://github.com/owncast/owncast.git
synced 2025-11-02 03:54:54 +08:00
other TS cleanup
This commit is contained in:
@ -1,3 +1,5 @@
|
|||||||
|
import { RequestInit } from 'node_modules/typescript/lib/lib.dom.d';
|
||||||
|
|
||||||
/* eslint-disable prefer-destructuring */
|
/* eslint-disable prefer-destructuring */
|
||||||
const ADMIN_USERNAME = process.env.NEXT_PUBLIC_ADMIN_USERNAME;
|
const ADMIN_USERNAME = process.env.NEXT_PUBLIC_ADMIN_USERNAME;
|
||||||
const ADMIN_STREAMKEY = process.env.NEXT_PUBLIC_ADMIN_STREAMKEY;
|
const ADMIN_STREAMKEY = process.env.NEXT_PUBLIC_ADMIN_STREAMKEY;
|
||||||
@ -43,7 +45,13 @@ export const UPDATE_CHAT_MESSGAE_VIZ = `${NEXT_PUBLIC_API_HOST}api/admin/chat/up
|
|||||||
|
|
||||||
const GITHUB_RELEASE_URL = "https://api.github.com/repos/owncast/owncast/releases/latest";
|
const GITHUB_RELEASE_URL = "https://api.github.com/repos/owncast/owncast/releases/latest";
|
||||||
|
|
||||||
export async function fetchData(url: string, options?: object) {
|
interface FetchOptions {
|
||||||
|
data?: any;
|
||||||
|
method?: string;
|
||||||
|
auth?: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
export async function fetchData(url: string, options?: FetchOptions) {
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
method = 'GET',
|
method = 'GET',
|
||||||
|
|||||||
@ -18,6 +18,9 @@ export function isEmptyObject(obj) {
|
|||||||
return !obj || (Object.keys(obj).length === 0 && obj.constructor === Object);
|
return !obj || (Object.keys(obj).length === 0 && obj.constructor === Object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function padLeft(text, pad, size) {
|
||||||
|
return String(pad.repeat(size) + text).slice(-size);
|
||||||
|
}
|
||||||
|
|
||||||
export function parseSecondsToDurationString(seconds = 0) {
|
export function parseSecondsToDurationString(seconds = 0) {
|
||||||
const finiteSeconds = Number.isFinite(+seconds) ? Math.abs(seconds) : 0;
|
const finiteSeconds = Number.isFinite(+seconds) ? Math.abs(seconds) : 0;
|
||||||
@ -36,7 +39,3 @@ export function parseSecondsToDurationString(seconds = 0) {
|
|||||||
|
|
||||||
return daysString + hoursString + minString + secsString;
|
return daysString + hoursString + minString + secsString;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function padLeft(text, pad, size) {
|
|
||||||
return String(pad.repeat(size) + text).slice(-size);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user