feat: only saving token on iOS
This commit is contained in:
@ -2,6 +2,7 @@ import { type Component, type JSX, Show } from "solid-js";
|
||||
import { jwtDecode } from "jwt-decode";
|
||||
import { Navigate } from "@solidjs/router";
|
||||
import { save_token } from "tauri-plugin-ios-shared-token-api";
|
||||
import { platform } from "@tauri-apps/plugin-os";
|
||||
|
||||
export const isTokenValid = (): boolean => {
|
||||
const token = localStorage.getItem("access");
|
||||
@ -29,9 +30,14 @@ export const ProtectedRoute: Component<{ children?: JSX.Element }> = (
|
||||
throw new Error("unreachable");
|
||||
}
|
||||
|
||||
save_token(token)
|
||||
.then(() => console.log("Saved token!!!"))
|
||||
.catch((e) => console.error(e));
|
||||
if (platform() === "ios") {
|
||||
// iOS share extension is a seperate process to the App.
|
||||
// Therefore, we need to share our access token somewhere both the App & Share Extension can access
|
||||
// This involves App Groups.
|
||||
save_token(token)
|
||||
.then(() => console.log("Saved token!!!"))
|
||||
.catch((e) => console.error(e));
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
|
Reference in New Issue
Block a user