mirror of
https://github.com/linux-do/new-api.git
synced 2025-11-11 16:43:41 +08:00
merge upstream
Signed-off-by: wozulong <>
This commit is contained in:
@@ -216,6 +216,15 @@ export const verifyJSON = (str) => {
|
||||
return true;
|
||||
};
|
||||
|
||||
export function verifyJSONPromise(value) {
|
||||
try {
|
||||
JSON.parse(value);
|
||||
return Promise.resolve();
|
||||
} catch (e) {
|
||||
return Promise.reject('不是合法的 JSON 字符串');
|
||||
}
|
||||
}
|
||||
|
||||
export function shouldShowPrompt(id) {
|
||||
let prompt = localStorage.getItem(`prompt-${id}`);
|
||||
return !prompt;
|
||||
|
||||
Reference in New Issue
Block a user