From 2185c6e6fb67c49be3099cf2b73e24c39bb97da3 Mon Sep 17 00:00:00 2001 From: rizky_denianto Date: Thu, 16 Jul 2026 21:39:04 +0700 Subject: [PATCH] Memperbaiki tipe data respon cek izin --- guest-js/index.ts | 10 +++++----- src/commands.rs | 2 +- src/desktop.rs | 4 ++-- src/mobile.rs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/guest-js/index.ts b/guest-js/index.ts index b0a5f8a..349f377 100644 --- a/guest-js/index.ts +++ b/guest-js/index.ts @@ -1,20 +1,20 @@ import { invoke } from "@tauri-apps/api/core"; import { SBlueclasMuatanKirim, SBlueclasResponDaftarPerangkat } from "./models"; -export async function cek_izin(): Promise { - return await invoke("plugin:bluclas|cek_izin").then((r) => r); +export async function cekIzin(): Promise { + return await invoke("plugin:bluclas|cek_izin").then((res: string) => res); } -export async function minta_izin(): Promise { +export async function mintaIzin(): Promise { return await invoke("plugin:bluclas|minta_izin"); } -export async function daftar_perangkat(): Promise< +export async function daftarPerangkat(): Promise< SBlueclasResponDaftarPerangkat[] > { return await invoke( "plugin:bluclas|daftar_perangkat", - ).then((r) => (r.value ? r.value : null)); + ).then((res: SBlueclasResponDaftarPerangkat[]) => res); } export async function kirim(value: SBlueclasMuatanKirim): Promise { diff --git a/src/commands.rs b/src/commands.rs index a91c47d..bc5c9c9 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -5,7 +5,7 @@ use crate::Result; use crate::models::*; #[command] -pub(crate) async fn cek_izin(app: AppHandle) -> Result { +pub(crate) async fn cek_izin(app: AppHandle) -> Result { return app.bluclas().cek_izin(); } diff --git a/src/desktop.rs b/src/desktop.rs index fc61630..c188a48 100644 --- a/src/desktop.rs +++ b/src/desktop.rs @@ -14,8 +14,8 @@ pub fn init( pub struct Bluclas(AppHandle); impl Bluclas { - pub fn cek_izin(&self) -> crate::Result { - return Ok(false); + pub fn cek_izin(&self) -> crate::Result { + return Ok(String::new()); } pub fn minta_izin(&self) -> crate::Result<()> { diff --git a/src/mobile.rs b/src/mobile.rs index 41b88b8..363a0bd 100644 --- a/src/mobile.rs +++ b/src/mobile.rs @@ -25,7 +25,7 @@ pub fn init( pub struct Bluclas(PluginHandle); impl Bluclas { - pub fn cek_izin(&self) -> crate::Result { + pub fn cek_izin(&self) -> crate::Result { return self .0 .run_mobile_plugin("checkPermissions", ())