mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-28 08:48:45 +02:00
fix require() actually not working after build in the frontend
This commit is contained in:
parent
b3bff8d735
commit
dfa9b3a0ca
@ -1,9 +1,5 @@
|
|||||||
/*
|
// Common JS cannot be used in frontend sadly
|
||||||
* Common functions - can be used in frontend or backend
|
// sleep, ucfirst is duplicated in ../src/util-frontend.js
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
exports.sleep = function (ms) {
|
exports.sleep = function (ms) {
|
||||||
return new Promise(resolve => setTimeout(resolve, ms));
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
const {sleep} = require("../../server/util")
|
import {sleep} from '../util-frontend'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { Modal } from 'bootstrap'
|
import { Modal } from 'bootstrap'
|
||||||
const {ucfirst} = require("../../server/util")
|
import { ucfirst } from '../util-frontend'
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
import Confirm from "./Confirm.vue";
|
import Confirm from "./Confirm.vue";
|
||||||
|
@ -5,6 +5,19 @@ import timezone from 'dayjs/plugin/timezone'
|
|||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
|
|
||||||
|
export function sleep(ms) {
|
||||||
|
return new Promise(resolve => setTimeout(resolve, ms));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function ucfirst(str) {
|
||||||
|
if (! str) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
const firstLetter = str.substr(0, 1);
|
||||||
|
return firstLetter.toUpperCase() + str.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function getTimezoneOffset(timeZone) {
|
function getTimezoneOffset(timeZone) {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
Loading…
Reference in New Issue
Block a user