コード整理

This commit is contained in:
harukin-expo-dev-env
2024-05-21 10:33:41 +00:00
parent 9df3d0c62a
commit 1fafe1649c
4 changed files with 44 additions and 52 deletions

View File

@@ -4,7 +4,25 @@ import {
TextWidget,
ListWidget,
} from "react-native-android-widget";
import dayjs from "dayjs";
import { ToastAndroid } from "react-native";
export const getDelayData = async () => {
// Fetch data from the server
const time = dayjs().format("HH:mm");
const delayString = await fetch(
"https://script.google.com/macros/s/AKfycbyKxch7z7l8e07LXulRHqxjVoIiB13kcgvoToLE-rqlxLmLSKdlmqz0FI1F2EuA7Zfg/exec"
)
.then((response) => response.text())
.then((data) => {
if (data !== "") {
return data.split("^");
}
return null;
});
ToastAndroid.show(`${delayString}`, ToastAndroid.SHORT);
return { time, delayString };
};
export function TraInfoEXWidget({ time, delayString }) {
return (
<FlexWidget