This commit is contained in:
j3d1 2023-05-14 16:43:42 +02:00
parent dfbe4d5dd4
commit 51d7788324

View file

@ -215,7 +215,7 @@ export default createStore({
console.log('ext_reply', ext_reply) console.log('ext_reply', ext_reply)
return true; return true;
}, },
async acceptFriend({state, dispatch}, {id, secret}) { async acceptFriend({state, dispatch}, {id, secret, befriender}) {
console.log('accepting friend ' + id) console.log('accepting friend ' + id)
state.home_server = 'localhost:8000' state.home_server = 'localhost:8000'
const home_reply = await dispatch('apiFederatedPost', { const home_reply = await dispatch('apiFederatedPost', {
@ -226,15 +226,15 @@ export default createStore({
} }
}) })
console.log('home_reply', home_reply) console.log('home_reply', home_reply)
const ext_serqver = await dispatch('getFriendServer', {username: home_reply.befriender}) const ext_server = await dispatch('getFriendServer', {username: befriender})
const ext_reply = await dispatch('apiFederatedPost', { const ext_reply = await dispatch('apiFederatedPost', {
host: ext_serqver[0], host: ext_server[0],
target: '/api/friendrequests/', target: '/api/friendrequests/',
data: { data: {
befriender: state.user, befriender: state.user,
befriendee: username, befriendee: befriender,
befriender_key: nacl.to_hex(state.keypair.signPk), befriender_key: nacl.to_hex(state.keypair.signPk),
secret: home_reply.secret secret: secret
} }
}) })
console.log('ext_reply', ext_reply) console.log('ext_reply', ext_reply)