Post to Slack (#603)
* Migrations
* WIP: Integration model, slack perms / hooks
* So so rough it pains me. Building this new model is revealing just how much needs to be refactored
* Working connect and post
* Cleanup UI, upating documents
* Show when slack command is connected
* stash
* 💚
* Add documents.update trigger
* Authorization, tidying
* Fixed integration policy
* pick integration presenter keys
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// @flow
|
||||
import React from 'react';
|
||||
import * as React from 'react';
|
||||
import styled from 'styled-components';
|
||||
import { inject } from 'mobx-react';
|
||||
import { slackAuth } from 'shared/utils/routeHelpers';
|
||||
@@ -11,19 +11,27 @@ type Props = {
|
||||
auth: AuthStore,
|
||||
scopes?: string[],
|
||||
redirectUri?: string,
|
||||
state?: string,
|
||||
label?: string,
|
||||
};
|
||||
|
||||
function SlackButton({ auth, scopes, redirectUri }: Props) {
|
||||
function SlackButton({ auth, state, label, scopes, redirectUri }: Props) {
|
||||
const handleClick = () =>
|
||||
(window.location.href = slackAuth(
|
||||
auth.getOauthState(),
|
||||
state ? auth.saveOauthState(state) : auth.genOauthState(),
|
||||
scopes,
|
||||
redirectUri
|
||||
));
|
||||
|
||||
return (
|
||||
<Button onClick={handleClick} icon={<SpacedSlackLogo size={24} />} neutral>
|
||||
Add to <strong>Slack</strong>
|
||||
{label ? (
|
||||
label
|
||||
) : (
|
||||
<span>
|
||||
Add to <strong>Slack</strong>
|
||||
</span>
|
||||
)}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user