Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix vk
Browse files Browse the repository at this point in the history
  • Loading branch information
vzalygin committed Jul 18, 2024
1 parent e547bb5 commit 5d68a1a
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
/public/assets

*.private
/node_modules
/node_modules
6 changes: 3 additions & 3 deletions app/javascript/controllers/vkid_controller.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Controller } from "@hotwired/stimulus"
import * as VKID from "@vkid/sdk"
import { Controller } from "@hotwired/stimulus";

export default class extends Controller {
static values ={
pkce: Object
}

connect() {
const VKID = window.VKIDSDK;
const data = this.pkceValue;
const challenge = data.challenge;
const state = data.state;
Expand All @@ -15,7 +15,7 @@ export default class extends Controller {
// Set VKID config with fetched data
VKID.Config.init({
app: 51989509, // Идентификатор приложения.
redirectUrl: 'http://localhost:3000/auth/vkontakte/callback', // Адрес для перехода после авторизации.
redirectUrl: 'http://localhost/auth/vkontakte/callback', // Адрес для перехода после авторизации.
codeChallenge: challenge,
state: state,
//scope: "friends wall"
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<meta charset="utf-8">
<title>Where my likes</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="https://unpkg.com/@vkid/sdk@<3.0.0/dist-sdk/umd/index.js"></script>
<%= javascript_importmap_tags %>
<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
<%= javascript_importmap_tags %>
</head>

<body>
Expand Down
6 changes: 2 additions & 4 deletions config/importmap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

pin '@hotwired/stimulus', to: '@hotwired--stimulus.js' # @3.2.2
pin '@stimulus/webpack-helpers', to: '@stimulus--webpack-helpers.js' # @2.0.0
pin 'crypto' # @2.0.1
pin 'crypto-js/enc-base64', to: 'crypto-js--enc-base64.js' # @4.2.0
pin 'crypto-js/sha256', to: 'crypto-js--sha256.js' # @4.2.0
pin '@hotwired/turbo', to: '@hotwired--turbo.js' # @8.0.4
pin '@rails/actioncable/src', to: '@rails--actioncable--src.js' # @7.1.3
pin '@vkid/sdk', to: '@vkid--sdk.js' # @1.1.1
pin '@hotwired/turbo-rails', to: '@hotwired--turbo-rails.js' # @8.0.4

# pin '@hotwired/stimulus-loading', to: 'stimulus-loading.js'
29 changes: 15 additions & 14 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5d68a1a

Please sign in to comment.