mirror of
https://github.com/wekan/wekan.git
synced 2026-02-15 04:28:07 +01:00
Migrate wekan-accounts-sandstorm from HTTP to fetch
This commit is contained in:
parent
5d6014d496
commit
788406c217
2 changed files with 14 additions and 10 deletions
|
|
@ -120,16 +120,20 @@ function loginWithSandstorm(connection, apiHost, apiToken) {
|
|||
|
||||
// Send the token in an HTTP POST request which on the server side will allow us to receive the
|
||||
// Sandstorm headers.
|
||||
HTTP.post(postUrl,
|
||||
{content: token, headers: headers},
|
||||
function (error, result) {
|
||||
if (error) {
|
||||
console.error("couldn't get /.sandstorm-login:", error);
|
||||
fetch(postUrl, {
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
body: token
|
||||
}).then(function (response) {
|
||||
if (!response.ok) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
}).catch(function (error) {
|
||||
console.error("couldn't get /.sandstorm-login:", error);
|
||||
|
||||
if (waiting) {
|
||||
// Try again in a second.
|
||||
Meteor.setTimeout(sendXhr, 1000);
|
||||
}
|
||||
if (waiting) {
|
||||
// Try again in a second.
|
||||
Meteor.setTimeout(sendXhr, 1000);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ Package.onUse(function(api) {
|
|||
api.use('random', ['client', 'server']);
|
||||
api.use('accounts-base', ['client', 'server'], {weak: true});
|
||||
api.use('webapp', 'server');
|
||||
api.use('http', 'client');
|
||||
api.use('fetch', 'client');
|
||||
api.use('tracker', 'client');
|
||||
api.use('reactive-var', 'client');
|
||||
api.use('check', 'server');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue