Ver código fonte

token as a parameter

Viktoriia 5 dias atrás
pai
commit
5a83e959d6
1 arquivos alterados com 9 adições e 1 exclusões
  1. 9 1
      App.tsx

+ 9 - 1
App.tsx

@@ -212,7 +212,15 @@ const InnerApp = () => {
 
   const handlePollPress = () => {
     if (!activePoll?.url) return;
-    Linking.openURL(activePoll.url).catch((err) => console.error('Failed to open poll URL:', err));
+
+    let url = activePoll.url;
+    const currentToken = storage.get('token', StoreType.STRING) as string | null;
+    if (currentToken) {
+      const separator = url.includes('?') ? '&' : '?';
+      url = `${url}${separator}token=${encodeURIComponent(currentToken)}`;
+    }
+
+    Linking.openURL(url).catch((err) => console.error('Failed to open poll URL:', err));
   };
 
   const handleUpdatePress = () => {